DMatDeclSymExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDECLSYMEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATDECLSYMEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
51 #include <blaze/math/Exception.h>
73 #include <blaze/util/Assert.h>
74 #include <blaze/util/DisableIf.h>
75 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/InvalidType.h>
79 #include <blaze/util/mpl/And.h>
80 #include <blaze/util/mpl/If.h>
81 #include <blaze/util/mpl/Not.h>
82 #include <blaze/util/mpl/Or.h>
83 #include <blaze/util/TrueType.h>
84 #include <blaze/util/Types.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // CLASS DMATDECLSYMEXPR
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
103 template< typename MT // Type of the dense matrix
104  , bool SO > // Storage order
106  : public DeclSymExpr< DenseMatrix< DMatDeclSymExpr<MT,SO>, SO > >
107  , public Declaration<MT>
108 {
109  private:
110  //**Type definitions****************************************************************************
111  using RT = ResultType_<MT>;
112  //**********************************************************************************************
113 
114  //**Serial evaluation strategy******************************************************************
116 
122  enum : bool { useAssign = RequiresEvaluation<MT>::value };
123 
125  template< typename MT2 >
127  struct UseAssign {
128  enum : bool { value = useAssign };
129  };
131  //**********************************************************************************************
132 
133  //**Parallel evaluation strategy****************************************************************
135 
140  template< typename MT2 >
141  struct UseSMPAssign {
142  enum : bool { value = MT2::smpAssignable && useAssign };
143  };
145  //**********************************************************************************************
146 
147  //**********************************************************************************************
149 
153  template< typename MT2 >
154  struct GetConstIterator {
156  struct Success { using Type = typename MT2::ConstIterator; };
157  struct Failure { using Type = INVALID_TYPE; };
158  using Type = typename If_< HasConstIterator<MT2>, Success, Failure >::Type;
159  };
161  //**********************************************************************************************
162 
163  public:
164  //**Type definitions****************************************************************************
171 
174 
176  using ConstIterator = typename GetConstIterator<MT>::Type;
177 
179  using Operand = If_< IsExpression<MT>, const MT, const MT& >;
180  //**********************************************************************************************
181 
182  //**Compilation flags***************************************************************************
184  enum : bool { simdEnabled = MT::simdEnabled };
185 
187  enum : bool { smpAssignable = MT::smpAssignable };
188  //**********************************************************************************************
189 
190  //**SIMD properties*****************************************************************************
192  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
193  //**********************************************************************************************
194 
195  //**Constructor*********************************************************************************
200  explicit inline DMatDeclSymExpr( const MT& dm ) noexcept
201  : dm_( dm ) // Dense matrix of the declsym expression
202  {
203  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
204  }
205  //**********************************************************************************************
206 
207  //**Access operator*****************************************************************************
214  inline ReturnType operator()( size_t i, size_t j ) const {
215  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
216  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
217  return dm_(i,j);
218  }
219  //**********************************************************************************************
220 
221  //**At function*********************************************************************************
229  inline ReturnType at( size_t i, size_t j ) const {
230  if( i >= dm_.rows() ) {
231  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
232  }
233  if( j >= dm_.columns() ) {
234  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
235  }
236  return (*this)(i,j);
237  }
238  //**********************************************************************************************
239 
240  //**Load function*******************************************************************************
247  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
248  BLAZE_INTERNAL_ASSERT( i < dm_.columns(), "Invalid row access index" );
249  BLAZE_INTERNAL_ASSERT( j < dm_.rows() , "Invalid column access index" );
250  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
251  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
252  return dm_.load(i,j);
253  }
254  //**********************************************************************************************
255 
256  //**Low-level data access***********************************************************************
261  inline const ElementType* data() const noexcept {
262  return dm_.data();
263  }
264  //**********************************************************************************************
265 
266  //**Begin function******************************************************************************
272  inline ConstIterator begin( size_t i ) const {
273  return ConstIterator( dm_.begin(i) );
274  }
275  //**********************************************************************************************
276 
277  //**End function********************************************************************************
283  inline ConstIterator end( size_t i ) const {
284  return ConstIterator( dm_.end(i) );
285  }
286  //**********************************************************************************************
287 
288  //**Rows function*******************************************************************************
293  inline size_t rows() const noexcept {
294  return dm_.rows();
295  }
296  //**********************************************************************************************
297 
298  //**Columns function****************************************************************************
303  inline size_t columns() const noexcept {
304  return dm_.columns();
305  }
306  //**********************************************************************************************
307 
308  //**Operand access******************************************************************************
313  inline Operand operand() const noexcept {
314  return dm_;
315  }
316  //**********************************************************************************************
317 
318  //**********************************************************************************************
324  template< typename T >
325  inline bool canAlias( const T* alias ) const noexcept {
326  return dm_.canAlias( alias );
327  }
328  //**********************************************************************************************
329 
330  //**********************************************************************************************
336  template< typename T >
337  inline bool isAliased( const T* alias ) const noexcept {
338  return dm_.isAliased( alias );
339  }
340  //**********************************************************************************************
341 
342  //**********************************************************************************************
347  inline bool isAligned() const noexcept {
348  return dm_.isAligned();
349  }
350  //**********************************************************************************************
351 
352  //**********************************************************************************************
357  inline bool canSMPAssign() const noexcept {
358  return dm_.canSMPAssign();
359  }
360  //**********************************************************************************************
361 
362  private:
363  //**Member variables****************************************************************************
365  //**********************************************************************************************
366 
367  //**Assignment to dense matrices****************************************************************
379  template< typename MT2 // Type of the target dense matrix
380  , bool SO2 > // Storage order of the target dense matrix
381  friend inline EnableIf_< UseAssign<MT2> >
382  assign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
383  {
385 
386  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
387  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
388 
389  assign( ~lhs, rhs.dm_ );
390  }
392  //**********************************************************************************************
393 
394  //**Assignment to sparse matrices***************************************************************
406  template< typename MT2 // Type of the target sparse matrix
407  , bool SO2 > // Storage order of the target dense matrix
408  friend inline EnableIf_< UseAssign<MT2> >
409  assign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
410  {
412 
413  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
414  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
415 
416  assign( ~lhs, rhs.dm_ );
417  }
419  //**********************************************************************************************
420 
421  //**Addition assignment to dense matrices*******************************************************
433  template< typename MT2 // Type of the target dense matrix
434  , bool SO2 > // Storage order of the target dense matrix
435  friend inline EnableIf_< UseAssign<MT2> >
436  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
437  {
439 
440  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
441  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
442 
443  addAssign( ~lhs, rhs.dm_ );
444  }
446  //**********************************************************************************************
447 
448  //**Addition assignment to sparse matrices******************************************************
460  template< typename MT2 // Type of the target sparse matrix
461  , bool SO2 > // Storage order of the target dense matrix
462  friend inline EnableIf_< UseAssign<MT2> >
463  addAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
464  {
466 
467  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
468  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
469 
470  addAssign( ~lhs, rhs.dm_ );
471  }
473  //**********************************************************************************************
474 
475  //**Subtraction assignment to dense matrices****************************************************
487  template< typename MT2 // Type of the target dense matrix
488  , bool SO2 > // Storage order of the target dense matrix
489  friend inline EnableIf_< UseAssign<MT2> >
490  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
491  {
493 
494  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
495  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
496 
497  subAssign( ~lhs, rhs.dm_ );
498  }
500  //**********************************************************************************************
501 
502  //**Subtraction assignment to sparse matrices***************************************************
514  template< typename MT2 // Type of the target sparse matrix
515  , bool SO2 > // Storage order of the target dense matrix
516  friend inline EnableIf_< UseAssign<MT2> >
517  subAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
518  {
520 
521  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
522  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
523 
524  subAssign( ~lhs, rhs.dm_ );
525  }
527  //**********************************************************************************************
528 
529  //**Schur product assignment to dense matrices**************************************************
541  template< typename MT2 // Type of the target dense matrix
542  , bool SO2 > // Storage order of the target dense matrix
543  friend inline EnableIf_< UseAssign<MT2> >
544  schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
545  {
547 
548  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
549  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
550 
551  schurAssign( ~lhs, rhs.dm_ );
552  }
554  //**********************************************************************************************
555 
556  //**Schur product assignment to sparse matrices*************************************************
568  template< typename MT2 // Type of the target sparse matrix
569  , bool SO2 > // Storage order of the target dense matrix
570  friend inline EnableIf_< UseAssign<MT2> >
571  schurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
572  {
574 
575  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
576  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
577 
578  schurAssign( ~lhs, rhs.dm_ );
579  }
581  //**********************************************************************************************
582 
583  //**Multiplication assignment to dense matrices*************************************************
595  template< typename MT2 // Type of the target dense matrix
596  , bool SO2 > // Storage order of the target dense matrix
597  friend inline EnableIf_< UseAssign<MT2> >
598  multAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
599  {
601 
602  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
603  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
604 
605  multAssign( ~lhs, rhs.dm_ );
606  }
608  //**********************************************************************************************
609 
610  //**Multiplication assignment to sparse matrices************************************************
622  template< typename MT2 // Type of the target sparse matrix
623  , bool SO2 > // Storage order of the target dense matrix
624  friend inline EnableIf_< UseAssign<MT2> >
625  multAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
626  {
628 
629  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
630  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
631 
632  multAssign( ~lhs, rhs.dm_ );
633  }
635  //**********************************************************************************************
636 
637  //**SMP assignment to dense matrices************************************************************
649  template< typename MT2 // Type of the target dense matrix
650  , bool SO2 > // Storage order of the target dense matrix
651  friend inline EnableIf_< UseSMPAssign<MT2> >
652  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
653  {
655 
656  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
657  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
658 
659  smpAssign( ~lhs, rhs.dm_ );
660  }
662  //**********************************************************************************************
663 
664  //**SMP assignment to sparse matrices***********************************************************
676  template< typename MT2 // Type of the target sparse matrix
677  , bool SO2 > // Storage order of the target dense matrix
678  friend inline EnableIf_< UseSMPAssign<MT2> >
679  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
680  {
682 
683  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
684  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
685 
686  smpAssign( ~lhs, rhs.dm_ );
687  }
689  //**********************************************************************************************
690 
691  //**SMP addition assignment to dense matrices***************************************************
703  template< typename MT2 // Type of the target dense matrix
704  , bool SO2 > // Storage order of the target dense matrix
705  friend inline EnableIf_< UseSMPAssign<MT2> >
706  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
707  {
709 
710  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
711  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
712 
713  smpAddAssign( ~lhs, rhs.dm_ );
714  }
716  //**********************************************************************************************
717 
718  //**SMP addition assignment to sparse matrices**************************************************
730  template< typename MT2 // Type of the target sparse matrix
731  , bool SO2 > // Storage order of the target dense matrix
732  friend inline EnableIf_< UseSMPAssign<MT2> >
733  smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
734  {
736 
737  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
738  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
739 
740  smpAddAssign( ~lhs, rhs.dm_ );
741  }
743  //**********************************************************************************************
744 
745  //**SMP subtraction assignment to dense matrices************************************************
757  template< typename MT2 // Type of the target dense matrix
758  , bool SO2 > // Storage order of the target dense matrix
759  friend inline EnableIf_< UseSMPAssign<MT2> >
760  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
761  {
763 
764  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
765  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
766 
767  smpSubAssign( ~lhs, rhs.dm_ );
768  }
770  //**********************************************************************************************
771 
772  //**SMP subtraction assignment to sparse matrices***********************************************
784  template< typename MT2 // Type of the target sparse matrix
785  , bool SO2 > // Storage order of the target dense matrix
786  friend inline EnableIf_< UseSMPAssign<MT2> >
787  smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
788  {
790 
791  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
792  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
793 
794  smpSubAssign( ~lhs, rhs.dm_ );
795  }
797  //**********************************************************************************************
798 
799  //**SMP Schur product assignment to dense matrices**********************************************
811  template< typename MT2 // Type of the target dense matrix
812  , bool SO2 > // Storage order of the target dense matrix
813  friend inline EnableIf_< UseSMPAssign<MT2> >
814  smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
815  {
817 
818  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
819  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
820 
821  smpSchurAssign( ~lhs, rhs.dm_ );
822  }
824  //**********************************************************************************************
825 
826  //**SMP Schur product assignment to sparse matrices*********************************************
838  template< typename MT2 // Type of the target sparse matrix
839  , bool SO2 > // Storage order of the target dense matrix
840  friend inline EnableIf_< UseSMPAssign<MT2> >
841  smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
842  {
844 
845  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
846  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
847 
848  smpSchurAssign( ~lhs, rhs.dm_ );
849  }
851  //**********************************************************************************************
852 
853  //**SMP multiplication assignment to dense matrices*********************************************
866  template< typename MT2 // Type of the target dense matrix
867  , bool SO2 > // Storage order of the target dense matrix
868  friend inline EnableIf_< UseSMPAssign<MT2> >
869  smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
870  {
872 
873  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
874  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
875 
876  smpMultAssign( ~lhs, rhs.dm_ );
877  }
879  //**********************************************************************************************
880 
881  //**SMP multiplication assignment to sparse matrices********************************************
894  template< typename MT2 // Type of the target sparse matrix
895  , bool SO2 > // Storage order of the target dense matrix
896  friend inline EnableIf_< UseSMPAssign<MT2> >
897  smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclSymExpr& rhs )
898  {
900 
901  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
902  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
903 
904  smpMultAssign( ~lhs, rhs.dm_ );
905  }
907  //**********************************************************************************************
908 
909  //**Compile time checks*************************************************************************
917  //**********************************************************************************************
918 };
919 //*************************************************************************************************
920 
921 
922 
923 
924 //=================================================================================================
925 //
926 // GLOBAL FUNCTIONS
927 //
928 //=================================================================================================
929 
930 //*************************************************************************************************
941 template< typename MT // Type of the dense matrix
942  , bool SO // Storage order
944 inline const DMatDeclSymExpr<MT,SO> declsym_backend( const DenseMatrix<MT,SO>& dm )
945 {
947 
948  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
949 
950  return DMatDeclSymExpr<MT,SO>( ~dm );
951 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
967 template< typename MT // Type of the dense matrix
968  , bool SO // Storage order
970 inline const IdentityMatrix<ElementType_<MT>,SO> declsym_backend( const DenseMatrix<MT,SO>& dm )
971 {
973 
974  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
975 
976  return IdentityMatrix<ElementType_<MT>,SO>( (~dm).rows() );
977 }
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
993 template< typename MT // Type of the dense matrix
994  , bool SO // Storage order
995  , typename = EnableIf_< IsSymmetric<MT> > >
996 inline const MT& declsym_backend( const DenseMatrix<MT,SO>& dm )
997 {
999 
1000  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
1001 
1002  return ~dm;
1003 }
1005 //*************************************************************************************************
1006 
1007 
1008 //*************************************************************************************************
1027 template< typename MT // Type of the dense matrix
1028  , bool SO > // Storage order
1029 inline decltype(auto) declsym( const DenseMatrix<MT,SO>& dm )
1030 {
1032 
1033  if( !isSquare( ~dm ) ) {
1034  BLAZE_THROW_INVALID_ARGUMENT( "Invalid symmetric matrix specification" );
1035  }
1036 
1037  return declsym_backend( ~dm );
1038 }
1039 //*************************************************************************************************
1040 
1041 
1042 
1043 
1044 //=================================================================================================
1045 //
1046 // GLOBAL RESTRUCTURING FUNCTIONS
1047 //
1048 //=================================================================================================
1049 
1050 //*************************************************************************************************
1064 template< typename MT // Type of the left-hand side dense matrix
1065  , typename ST // Type of the right-hand side scalar value
1066  , bool SO // Storage order
1067  , typename = DisableIf_< IsSymmetric<MT> > >
1068 inline decltype(auto) declsym( const DMatScalarMultExpr<MT,ST,SO>& dm )
1069 {
1071 
1072  if( !isSquare( dm ) ) {
1073  BLAZE_THROW_INVALID_ARGUMENT( "Invalid symmetric matrix specification" );
1074  }
1075 
1076  return declsym( dm.leftOperand() ) * dm.rightOperand();
1077 }
1079 //*************************************************************************************************
1080 
1081 
1082 
1083 
1084 //=================================================================================================
1085 //
1086 // ROWS SPECIALIZATIONS
1087 //
1088 //=================================================================================================
1089 
1090 //*************************************************************************************************
1092 template< typename MT, bool SO >
1093 struct Rows< DMatDeclSymExpr<MT,SO> >
1094  : public Rows<MT>
1095 {};
1097 //*************************************************************************************************
1098 
1099 
1100 
1101 
1102 //=================================================================================================
1103 //
1104 // COLUMNS SPECIALIZATIONS
1105 //
1106 //=================================================================================================
1107 
1108 //*************************************************************************************************
1110 template< typename MT, bool SO >
1111 struct Columns< DMatDeclSymExpr<MT,SO> >
1112  : public Columns<MT>
1113 {};
1115 //*************************************************************************************************
1116 
1117 
1118 
1119 
1120 //=================================================================================================
1121 //
1122 // ISALIGNED SPECIALIZATIONS
1123 //
1124 //=================================================================================================
1125 
1126 //*************************************************************************************************
1128 template< typename MT, bool SO >
1129 struct IsAligned< DMatDeclSymExpr<MT,SO> >
1130  : public BoolConstant< IsAligned<MT>::value >
1131 {};
1133 //*************************************************************************************************
1134 
1135 
1136 
1137 
1138 //=================================================================================================
1139 //
1140 // ISSYMMETRIC SPECIALIZATIONS
1141 //
1142 //=================================================================================================
1143 
1144 //*************************************************************************************************
1146 template< typename MT, bool SO >
1147 struct IsSymmetric< DMatDeclSymExpr<MT,SO> >
1148  : public TrueType
1149 {};
1151 //*************************************************************************************************
1152 
1153 
1154 
1155 
1156 //=================================================================================================
1157 //
1158 // ISHERMITIAN SPECIALIZATIONS
1159 //
1160 //=================================================================================================
1161 
1162 //*************************************************************************************************
1164 template< typename MT, bool SO >
1165 struct IsHermitian< DMatDeclSymExpr<MT,SO> >
1166  : public BoolConstant< IsHermitian<MT>::value >
1167 {};
1169 //*************************************************************************************************
1170 
1171 
1172 
1173 
1174 //=================================================================================================
1175 //
1176 // ISLOWER SPECIALIZATIONS
1177 //
1178 //=================================================================================================
1179 
1180 //*************************************************************************************************
1182 template< typename MT, bool SO >
1183 struct IsLower< DMatDeclSymExpr<MT,SO> >
1184  : public BoolConstant< IsLower<MT>::value >
1185 {};
1187 //*************************************************************************************************
1188 
1189 
1190 
1191 
1192 //=================================================================================================
1193 //
1194 // ISUNILOWER SPECIALIZATIONS
1195 //
1196 //=================================================================================================
1197 
1198 //*************************************************************************************************
1200 template< typename MT, bool SO >
1201 struct IsUniLower< DMatDeclSymExpr<MT,SO> >
1202  : public BoolConstant< IsUniLower<MT>::value >
1203 {};
1205 //*************************************************************************************************
1206 
1207 
1208 
1209 
1210 //=================================================================================================
1211 //
1212 // ISSTRICTLYLOWER SPECIALIZATIONS
1213 //
1214 //=================================================================================================
1215 
1216 //*************************************************************************************************
1218 template< typename MT, bool SO >
1219 struct IsStrictlyLower< DMatDeclSymExpr<MT,SO> >
1220  : public BoolConstant< IsStrictlyLower<MT>::value >
1221 {};
1223 //*************************************************************************************************
1224 
1225 
1226 
1227 
1228 //=================================================================================================
1229 //
1230 // ISUPPER SPECIALIZATIONS
1231 //
1232 //=================================================================================================
1233 
1234 //*************************************************************************************************
1236 template< typename MT, bool SO >
1237 struct IsUpper< DMatDeclSymExpr<MT,SO> >
1238  : public BoolConstant< IsUpper<MT>::value >
1239 {};
1241 //*************************************************************************************************
1242 
1243 
1244 
1245 
1246 //=================================================================================================
1247 //
1248 // ISUNIUPPER SPECIALIZATIONS
1249 //
1250 //=================================================================================================
1251 
1252 //*************************************************************************************************
1254 template< typename MT, bool SO >
1255 struct IsUniUpper< DMatDeclSymExpr<MT,SO> >
1256  : public BoolConstant< IsUniUpper<MT>::value >
1257 {};
1259 //*************************************************************************************************
1260 
1261 
1262 
1263 
1264 //=================================================================================================
1265 //
1266 // ISSTRICTLYUPPER SPECIALIZATIONS
1267 //
1268 //=================================================================================================
1269 
1270 //*************************************************************************************************
1272 template< typename MT, bool SO >
1273 struct IsStrictlyUpper< DMatDeclSymExpr<MT,SO> >
1274  : public BoolConstant< IsStrictlyUpper<MT>::value >
1275 {};
1277 //*************************************************************************************************
1278 
1279 } // namespace blaze
1280 
1281 #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.
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatDeclSymExpr.h:170
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDeclSymExpr.h:272
Header file for the Rows type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDeclSymExpr.h:325
Header file for the IsUniUpper type trait.
EnableIf_< IsDenseMatrix< MT1 > > smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:196
Header file for basic type definitions.
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
#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
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
#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
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDeclSymExpr.h:168
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the And class template.
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
#define BLAZE_CREATE_HAS_TYPE_MEMBER_TYPE_TRAIT(TYPE_TRAIT_NAME, MEMBER_NAME)
Macro for the creation of a type trait for compile time checks for member types.This macro creates th...
Definition: HasMember.h:182
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
Header file for the RequiresEvaluation type trait.
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatDeclSymExpr.h:313
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDeclSymExpr.h:347
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDeclSymExpr.h:229
Header file for the SIMD trait.
Header file for the IsUniLower type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:78
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Header file for all forward declarations for sparse vectors and matrices.
Header file for the implementation of the base template of the SymmetricMatrix.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDeclSymExpr.h:337
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:72
typename DeclSymTrait< MT >::Type DeclSymTrait_
Auxiliary alias declaration for the DeclSymTrait type trait.The DeclSymTrait_ alias declaration provi...
Definition: DeclSymTrait.h:177
Compile time check for upper unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniUpper.h:86
Efficient implementation of an identity matrix.The IdentityMatrix class template is the representati...
Definition: Forward.h:49
If_< IsExpression< MT >, const MT, const MT &> Operand
Composite data type of the dense matrix expression.
Definition: DMatDeclSymExpr.h:179
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
DMatDeclSymExpr(const MT &dm) noexcept
Constructor for the DMatDeclSymExpr class.
Definition: DMatDeclSymExpr.h:200
Header file for the If class template.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDeclSymExpr.h:283
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Header file for the Or class template.
Expression object for dense matrix-scalar multiplications.The DMatScalarMultExpr class represents the...
Definition: DMatScalarMultExpr.h:110
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDeclSymExpr.h:293
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
typename GetConstIterator< MT >::Type ConstIterator
Iterator over the elements of the dense matrix.
Definition: DMatDeclSymExpr.h:176
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDeclSymExpr.h:303
Operand dm_
Dense matrix of the declsym expression.
Definition: DMatDeclSymExpr.h:364
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
#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:88
Header file for the IsUniTriangular type trait.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DMatScalarMultExpr.h:567
Constraints on the storage order of matrix types.
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDeclSymExpr.h:357
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Header file for all forward declarations for expression class templates.
Base class for all declsym expression templates.The DeclSymExpr class serves as a tag for all express...
Definition: DeclSymExpr.h:66
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the DeclSymExpr base class.
Compile time check for lower unitriangular matrices.This type trait tests whether or not the given te...
Definition: IsUniLower.h:86
const ElementType * data() const noexcept
Low-level data access to the matrix elements.
Definition: DMatDeclSymExpr.h:261
Constraint on the data type.
Header file for the Declaration base class.
#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
ResultType_< MT > RT
Result type of the dense matrix expression.
Definition: DMatDeclSymExpr.h:111
Header file for run time assertion macros.
Utility type for generic codes.
ElementType_< MT > ElementType
Resulting element type.
Definition: DMatDeclSymExpr.h:169
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
Header file for the declsym trait.
#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
decltype(auto) declsym(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as symmetric.
Definition: DMatDeclSymExpr.h:1029
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
DeclSymTrait_< RT > ResultType
Result type for expression template evaluations.
Definition: DMatDeclSymExpr.h:166
Constraint on the data type.
Header file for the HasMember type traits.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:263
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
Expression object for the explicit symmetry declaration of dense matrices.The DMatDeclSymExpr class r...
Definition: DMatDeclSymExpr.h:105
Header file for the IntegralConstant class template.
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:75
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:75
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
Header file for the IsUpper type trait.
Constraint on the data type.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDeclSymExpr.h:214
If_< RequiresEvaluation< MT >, const ResultType, const DMatDeclSymExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatDeclSymExpr.h:173
Header file for the IsHermitian type trait.
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDeclSymExpr.h:247
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatScalarMultExpr.h:557
#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
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDeclSymExpr.h:167
Header file for the TrueType type/value trait base class.
Compile time check for unitriangular matrix types.This type trait tests whether or not the given temp...
Definition: IsUniTriangular.h:87
Header file for the IsExpression type trait class.
Header file for the function trace functionality.