DMatScalarDivExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATSCALARDIVEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATSCALARDIVEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
54 #include <blaze/math/SIMD.h>
77 #include <blaze/system/Inline.h>
79 #include <blaze/util/Assert.h>
83 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/mpl/And.h>
86 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/mpl/Or.h>
88 #include <blaze/util/Types.h>
93 
94 
95 namespace blaze {
96 
97 //=================================================================================================
98 //
99 // CLASS DMATSCALARDIVEXPR
100 //
101 //=================================================================================================
102 
103 //*************************************************************************************************
110 template< typename MT // Type of the left-hand side dense matrix
111  , typename ST // Type of the right-hand side scalar value
112  , bool SO > // Storage order
114  : public MatScalarDivExpr< DenseMatrix< DMatScalarDivExpr<MT,ST,SO>, SO > >
115  , private Computation
116 {
117  private:
118  //**Type definitions****************************************************************************
119  using RT = ResultType_<MT>;
120  using RN = ReturnType_<MT>;
123  //**********************************************************************************************
124 
125  //**Return type evaluation**********************************************************************
127 
132  enum : bool { returnExpr = !IsTemporary<RN>::value };
133 
136  //**********************************************************************************************
137 
138  //**Serial evaluation strategy******************************************************************
140 
146  enum : bool { useAssign = IsComputation<MT>::value && RequiresEvaluation<MT>::value };
147 
149  template< typename MT2 >
151  struct UseAssign {
152  enum : bool { value = useAssign };
153  };
155  //**********************************************************************************************
156 
157  //**Parallel evaluation strategy****************************************************************
159 
165  template< typename MT2 >
166  struct UseSMPAssign {
167  enum : bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
168  };
170  //**********************************************************************************************
171 
172  public:
173  //**Type definitions****************************************************************************
179 
182 
185 
187  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
188 
190  using RightOperand = ST;
191  //**********************************************************************************************
192 
193  //**ConstIterator class definition**************************************************************
197  {
198  public:
199  //**Type definitions*************************************************************************
200  using IteratorCategory = std::random_access_iterator_tag;
205 
206  // STL iterator requirements
212 
215  //*******************************************************************************************
216 
217  //**Constructor******************************************************************************
223  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
224  : iterator_( iterator ) // Iterator to the current element
225  , scalar_ ( scalar ) // Scalar of the multiplication expression
226  {}
227  //*******************************************************************************************
228 
229  //**Addition assignment operator*************************************************************
235  inline ConstIterator& operator+=( size_t inc ) {
236  iterator_ += inc;
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Subtraction assignment operator**********************************************************
247  inline ConstIterator& operator-=( size_t dec ) {
248  iterator_ -= dec;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Prefix increment operator****************************************************************
259  ++iterator_;
260  return *this;
261  }
262  //*******************************************************************************************
263 
264  //**Postfix increment operator***************************************************************
269  inline const ConstIterator operator++( int ) {
270  return ConstIterator( iterator_++ );
271  }
272  //*******************************************************************************************
273 
274  //**Prefix decrement operator****************************************************************
280  --iterator_;
281  return *this;
282  }
283  //*******************************************************************************************
284 
285  //**Postfix decrement operator***************************************************************
290  inline const ConstIterator operator--( int ) {
291  return ConstIterator( iterator_-- );
292  }
293  //*******************************************************************************************
294 
295  //**Element access operator******************************************************************
300  inline ReturnType operator*() const {
301  return *iterator_ / scalar_;
302  }
303  //*******************************************************************************************
304 
305  //**Load function****************************************************************************
310  inline auto load() const noexcept {
311  return iterator_.load() / set( scalar_ );
312  }
313  //*******************************************************************************************
314 
315  //**Equality operator************************************************************************
321  inline bool operator==( const ConstIterator& rhs ) const {
322  return iterator_ == rhs.iterator_;
323  }
324  //*******************************************************************************************
325 
326  //**Inequality operator**********************************************************************
332  inline bool operator!=( const ConstIterator& rhs ) const {
333  return iterator_ != rhs.iterator_;
334  }
335  //*******************************************************************************************
336 
337  //**Less-than operator***********************************************************************
343  inline bool operator<( const ConstIterator& rhs ) const {
344  return iterator_ < rhs.iterator_;
345  }
346  //*******************************************************************************************
347 
348  //**Greater-than operator********************************************************************
354  inline bool operator>( const ConstIterator& rhs ) const {
355  return iterator_ > rhs.iterator_;
356  }
357  //*******************************************************************************************
358 
359  //**Less-or-equal-than operator**************************************************************
365  inline bool operator<=( const ConstIterator& rhs ) const {
366  return iterator_ <= rhs.iterator_;
367  }
368  //*******************************************************************************************
369 
370  //**Greater-or-equal-than operator***********************************************************
376  inline bool operator>=( const ConstIterator& rhs ) const {
377  return iterator_ >= rhs.iterator_;
378  }
379  //*******************************************************************************************
380 
381  //**Subtraction operator*********************************************************************
387  inline DifferenceType operator-( const ConstIterator& rhs ) const {
388  return iterator_ - rhs.iterator_;
389  }
390  //*******************************************************************************************
391 
392  //**Addition operator************************************************************************
399  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
400  return ConstIterator( it.iterator_ + inc, it.scalar_ );
401  }
402  //*******************************************************************************************
403 
404  //**Addition operator************************************************************************
411  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
412  return ConstIterator( it.iterator_ + inc, it.scalar_ );
413  }
414  //*******************************************************************************************
415 
416  //**Subtraction operator*********************************************************************
423  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
424  return ConstIterator( it.iterator_ - dec, it.scalar_ );
425  }
426  //*******************************************************************************************
427 
428  private:
429  //**Member variables*************************************************************************
432  //*******************************************************************************************
433  };
434  //**********************************************************************************************
435 
436  //**Compilation flags***************************************************************************
438  enum : bool { simdEnabled = MT::simdEnabled &&
441  HasSIMDDiv<UnderlyingElement_<ET>,ST>::value ) };
442 
444  enum : bool { smpAssignable = MT::smpAssignable };
445  //**********************************************************************************************
446 
447  //**SIMD properties*****************************************************************************
449  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
450  //**********************************************************************************************
451 
452  //**Constructor*********************************************************************************
458  explicit inline DMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
459  : matrix_( matrix ) // Left-hand side dense matrix of the division expression
460  , scalar_( scalar ) // Right-hand side scalar of the division expression
461  {}
462  //**********************************************************************************************
463 
464  //**Access operator*****************************************************************************
471  inline ReturnType operator()( size_t i, size_t j ) const {
472  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
473  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
474  return matrix_(i,j) / scalar_;
475  }
476  //**********************************************************************************************
477 
478  //**At function*********************************************************************************
486  inline ReturnType at( size_t i, size_t j ) const {
487  if( i >= matrix_.rows() ) {
488  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
489  }
490  if( j >= matrix_.columns() ) {
491  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
492  }
493  return (*this)(i,j);
494  }
495  //**********************************************************************************************
496 
497  //**Load function*******************************************************************************
504  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
505  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
506  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
507  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
508  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
509  return matrix_.load(i,j) / set( scalar_ );
510  }
511  //**********************************************************************************************
512 
513  //**Begin function******************************************************************************
519  inline ConstIterator begin( size_t i ) const {
520  return ConstIterator( matrix_.begin(i), scalar_ );
521  }
522  //**********************************************************************************************
523 
524  //**End function********************************************************************************
530  inline ConstIterator end( size_t i ) const {
531  return ConstIterator( matrix_.end(i), scalar_ );
532  }
533  //**********************************************************************************************
534 
535  //**Rows function*******************************************************************************
540  inline size_t rows() const noexcept {
541  return matrix_.rows();
542  }
543  //**********************************************************************************************
544 
545  //**Columns function****************************************************************************
550  inline size_t columns() const noexcept {
551  return matrix_.columns();
552  }
553  //**********************************************************************************************
554 
555  //**Left operand access*************************************************************************
560  inline LeftOperand leftOperand() const noexcept {
561  return matrix_;
562  }
563  //**********************************************************************************************
564 
565  //**Right operand access************************************************************************
570  inline RightOperand rightOperand() const noexcept {
571  return scalar_;
572  }
573  //**********************************************************************************************
574 
575  //**********************************************************************************************
581  template< typename T >
582  inline bool canAlias( const T* alias ) const noexcept {
583  return IsExpression<MT>::value && matrix_.canAlias( alias );
584  }
585  //**********************************************************************************************
586 
587  //**********************************************************************************************
593  template< typename T >
594  inline bool isAliased( const T* alias ) const noexcept {
595  return matrix_.isAliased( alias );
596  }
597  //**********************************************************************************************
598 
599  //**********************************************************************************************
604  inline bool isAligned() const noexcept {
605  return matrix_.isAligned();
606  }
607  //**********************************************************************************************
608 
609  //**********************************************************************************************
614  inline bool canSMPAssign() const noexcept {
615  return matrix_.canSMPAssign() ||
616  ( rows() * columns() >= SMP_DMATSCALARMULT_THRESHOLD );
617  }
618  //**********************************************************************************************
619 
620  private:
621  //**Member variables****************************************************************************
624  //**********************************************************************************************
625 
626  //**Assignment to dense matrices****************************************************************
640  template< typename MT2 // Type of the target dense matrix
641  , bool SO2 > // Storage order of the target dense matrix
642  friend inline EnableIf_< UseAssign<MT2> >
643  assign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
644  {
646 
647  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
648  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
649 
650  assign( ~lhs, rhs.matrix_ );
651  assign( ~lhs, (~lhs) / rhs.scalar_ );
652  }
654  //**********************************************************************************************
655 
656  //**Assignment to sparse matrices***************************************************************
670  template< typename MT2 // Type of the target sparse matrix
671  , bool SO2 > // Storage order of the target sparse matrix
672  friend inline EnableIf_< UseAssign<MT2> >
673  assign( SparseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
674  {
676 
677  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
678  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
679 
680  assign( ~lhs, rhs.matrix_ );
681  (~lhs) /= rhs.scalar_;
682  }
684  //**********************************************************************************************
685 
686  //**Addition assignment to dense matrices*******************************************************
700  template< typename MT2 // Type of the target dense matrix
701  , bool SO2 > // Storage order of the target dense matrix
702  friend inline EnableIf_< UseAssign<MT2> >
703  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
704  {
706 
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  const ResultType tmp( serial( rhs ) );
715  addAssign( ~lhs, tmp );
716  }
718  //**********************************************************************************************
719 
720  //**Addition assignment to sparse matrices******************************************************
721  // No special implementation for the addition assignment to sparse matrices.
722  //**********************************************************************************************
723 
724  //**Subtraction assignment to dense matrices****************************************************
738  template< typename MT2 // Type of the target dense matrix
739  , bool SO2 > // Storage order of the target dense matrix
740  friend inline EnableIf_< UseAssign<MT2> >
741  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
742  {
744 
748 
749  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
750  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
751 
752  const ResultType tmp( serial( rhs ) );
753  subAssign( ~lhs, tmp );
754  }
756  //**********************************************************************************************
757 
758  //**Subtraction assignment to sparse matrices***************************************************
759  // No special implementation for the subtraction assignment to sparse matrices.
760  //**********************************************************************************************
761 
762  //**Schur product assignment to dense matrices**************************************************
776  template< typename MT2 // Type of the target dense matrix
777  , bool SO2 > // Storage order of the target dense matrix
778  friend inline EnableIf_< UseAssign<MT2> >
779  schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
780  {
782 
786 
787  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
788  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
789 
790  const ResultType tmp( serial( rhs ) );
791  schurAssign( ~lhs, tmp );
792  }
794  //**********************************************************************************************
795 
796  //**Schur product assignment to sparse matrices*************************************************
797  // No special implementation for the Schur product assignment to sparse matrices.
798  //**********************************************************************************************
799 
800  //**Multiplication assignment to dense matrices*************************************************
801  // No special implementation for the multiplication assignment to dense matrices.
802  //**********************************************************************************************
803 
804  //**Multiplication assignment to sparse matrices************************************************
805  // No special implementation for the multiplication assignment to sparse matrices.
806  //**********************************************************************************************
807 
808  //**SMP assignment to dense matrices************************************************************
822  template< typename MT2 // Type of the target dense matrix
823  , bool SO2 > // Storage order of the target dense matrix
824  friend inline EnableIf_< UseSMPAssign<MT2> >
826  {
828 
829  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
830  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
831 
832  smpAssign( ~lhs, rhs.matrix_ );
833  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
834  }
836  //**********************************************************************************************
837 
838  //**SMP assignment to sparse matrices***********************************************************
852  template< typename MT2 // Type of the target sparse matrix
853  , bool SO2 > // Storage order of the target sparse matrix
854  friend inline EnableIf_< UseSMPAssign<MT2> >
856  {
858 
859  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
860  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
861 
862  smpAssign( ~lhs, rhs.matrix_ );
863  (~lhs) /= rhs.scalar_;
864  }
866  //**********************************************************************************************
867 
868  //**SMP addition assignment to dense matrices***************************************************
882  template< typename MT2 // Type of the target dense matrix
883  , bool SO2 > // Storage order of the target dense matrix
884  friend inline EnableIf_< UseSMPAssign<MT2> >
886  {
888 
892 
893  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
894  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
895 
896  const ResultType tmp( rhs );
897  smpAddAssign( ~lhs, tmp );
898  }
900  //**********************************************************************************************
901 
902  //**SMP addition assignment to sparse matrices**************************************************
903  // No special implementation for the SMP addition assignment to sparse matrices.
904  //**********************************************************************************************
905 
906  //**SMP subtraction assignment to dense matrices************************************************
920  template< typename MT2 // Type of the target dense matrix
921  , bool SO2 > // Storage order of the target dense matrix
922  friend inline EnableIf_< UseSMPAssign<MT2> >
924  {
926 
930 
931  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
932  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
933 
934  const ResultType tmp( rhs );
935  smpSubAssign( ~lhs, tmp );
936  }
938  //**********************************************************************************************
939 
940  //**SMP subtraction assignment to sparse matrices***********************************************
941  // No special implementation for the SMP subtraction assignment to sparse matrices.
942  //**********************************************************************************************
943 
944  //**SMP Schur product assignment to dense matrices**********************************************
958  template< typename MT2 // Type of the target dense matrix
959  , bool SO2 > // Storage order of the target dense matrix
960  friend inline EnableIf_< UseSMPAssign<MT2> >
962  {
964 
968 
969  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
970  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
971 
972  const ResultType tmp( rhs );
973  smpSchurAssign( ~lhs, tmp );
974  }
976  //**********************************************************************************************
977 
978  //**SMP Schur product assignment to sparse matrices*********************************************
979  // No special implementation for the SMP Schur product assignment to sparse matrices.
980  //**********************************************************************************************
981 
982  //**SMP multiplication assignment to dense matrices*********************************************
983  // No special implementation for the SMP multiplication assignment to dense matrices.
984  //**********************************************************************************************
985 
986  //**SMP multiplication assignment to sparse matrices********************************************
987  // No special implementation for the SMP multiplication assignment to sparse matrices.
988  //**********************************************************************************************
989 
990  //**Compile time checks*************************************************************************
999  //**********************************************************************************************
1000 };
1001 //*************************************************************************************************
1002 
1003 
1004 
1005 
1006 //=================================================================================================
1007 //
1008 // GLOBAL BINARY ARITHMETIC OPERATORS
1009 //
1010 //=================================================================================================
1011 
1012 //*************************************************************************************************
1017 template< typename MT // Type of the left-hand side dense matrix
1018  , typename ST // Type of the right-hand side scalar
1019  , bool SO > // Storage order
1020 struct DMatScalarDivExprHelper
1021 {
1022  private:
1023  //**********************************************************************************************
1027  , IsBuiltin<ST> >
1030  , ST >;
1031  //**********************************************************************************************
1032 
1033  public:
1034  //**********************************************************************************************
1035  using Type = If_< IsInvertible<ScalarType>
1038  //**********************************************************************************************
1039 };
1041 //*************************************************************************************************
1042 
1043 
1044 //*************************************************************************************************
1066 template< typename MT // Type of the left-hand side dense matrix
1067  , bool SO // Storage order of the left-hand side dense matrix
1068  , typename ST // Type of the right-hand side scalar
1069  , typename = EnableIf_< IsNumeric<ST> > >
1070 inline decltype(auto) operator/( const DenseMatrix<MT,SO>& mat, ST scalar )
1071 {
1073 
1074  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
1075 
1076  using ReturnType = typename DMatScalarDivExprHelper<MT,ST,SO>::Type;
1077  using ScalarType = RightOperand_<ReturnType>;
1078 
1080  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
1081  }
1082  else {
1083  return ReturnType( ~mat, scalar );
1084  }
1085 }
1086 //*************************************************************************************************
1087 
1088 
1089 
1090 
1091 //=================================================================================================
1092 //
1093 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1094 //
1095 //=================================================================================================
1096 
1097 //*************************************************************************************************
1110 template< typename MT // Type of the dense matrix of the left-hand side expression
1111  , typename ST1 // Type of the scalar of the left-hand side expression
1112  , bool SO // Storage order of the dense matrix
1113  , typename ST2 // Type of the right-hand side scalar
1115 inline decltype(auto) operator*( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1116 {
1118 
1119  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1120 }
1122 //*************************************************************************************************
1123 
1124 
1125 //*************************************************************************************************
1138 template< typename ST1 // Type of the left-hand side scalar
1139  , typename MT // Type of the dense matrix of the right-hand side expression
1140  , typename ST2 // Type of the scalar of the right-hand side expression
1141  , bool SO // Storage order of the dense matrix
1142  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
1143 inline decltype(auto) operator*( ST1 scalar, const DMatScalarDivExpr<MT,ST2,SO>& mat )
1144 {
1146 
1147  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1148 }
1150 //*************************************************************************************************
1151 
1152 
1153 //*************************************************************************************************
1166 template< typename MT // Type of the dense matrix of the left-hand side expression
1167  , typename ST1 // Type of the scalar of the left-hand side expression
1168  , bool SO // Storage order of the dense matrix
1169  , typename ST2 // Type of the right-hand side scalar
1170  , typename = EnableIf_< IsNumeric<ST2> > >
1171 inline decltype(auto) operator/( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1172 {
1174 
1175  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1176 
1177  using MultType = MultTrait_<ST1,ST2>;
1178  using ReturnType = typename DMatScalarDivExprHelper<MT,MultType,SO>::Type;
1179  using ScalarType = RightOperand_<ReturnType>;
1180 
1182  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1183  }
1184  else {
1185  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1186  }
1187 }
1189 //*************************************************************************************************
1190 
1191 
1192 
1193 
1194 //=================================================================================================
1195 //
1196 // SIZE SPECIALIZATIONS
1197 //
1198 //=================================================================================================
1199 
1200 //*************************************************************************************************
1202 template< typename MT, typename ST, bool SO >
1203 struct Size< DMatScalarDivExpr<MT,ST,SO>, 0UL >
1204  : public Size<MT,0UL>
1205 {};
1206 
1207 template< typename MT, typename ST, bool SO >
1208 struct Size< DMatScalarDivExpr<MT,ST,SO>, 1UL >
1209  : public Size<MT,1UL>
1210 {};
1212 //*************************************************************************************************
1213 
1214 
1215 
1216 
1217 //=================================================================================================
1218 //
1219 // ISALIGNED SPECIALIZATIONS
1220 //
1221 //=================================================================================================
1222 
1223 //*************************************************************************************************
1225 template< typename MT, typename ST, bool SO >
1226 struct IsAligned< DMatScalarDivExpr<MT,ST,SO> >
1227  : public IsAligned<MT>
1228 {};
1230 //*************************************************************************************************
1231 
1232 
1233 
1234 
1235 //=================================================================================================
1236 //
1237 // ISPADDED SPECIALIZATIONS
1238 //
1239 //=================================================================================================
1240 
1241 //*************************************************************************************************
1243 template< typename MT, typename ST, bool SO >
1244 struct IsPadded< DMatScalarDivExpr<MT,ST,SO> >
1245  : public IsPadded<MT>
1246 {};
1248 //*************************************************************************************************
1249 
1250 
1251 
1252 
1253 //=================================================================================================
1254 //
1255 // ISSYMMETRIC SPECIALIZATIONS
1256 //
1257 //=================================================================================================
1258 
1259 //*************************************************************************************************
1261 template< typename MT, typename ST, bool SO >
1262 struct IsSymmetric< DMatScalarDivExpr<MT,ST,SO> >
1263  : public IsSymmetric<MT>
1264 {};
1266 //*************************************************************************************************
1267 
1268 
1269 
1270 
1271 //=================================================================================================
1272 //
1273 // ISHERMITIAN SPECIALIZATIONS
1274 //
1275 //=================================================================================================
1276 
1277 //*************************************************************************************************
1279 template< typename MT, typename ST, bool SO >
1280 struct IsHermitian< DMatScalarDivExpr<MT,ST,SO> >
1281  : public IsHermitian<MT>
1282 {};
1284 //*************************************************************************************************
1285 
1286 
1287 
1288 
1289 //=================================================================================================
1290 //
1291 // ISLOWER SPECIALIZATIONS
1292 //
1293 //=================================================================================================
1294 
1295 //*************************************************************************************************
1297 template< typename MT, typename ST, bool SO >
1298 struct IsLower< DMatScalarDivExpr<MT,ST,SO> >
1299  : public IsLower<MT>
1300 {};
1302 //*************************************************************************************************
1303 
1304 
1305 
1306 
1307 //=================================================================================================
1308 //
1309 // ISSTRICTLYLOWER SPECIALIZATIONS
1310 //
1311 //=================================================================================================
1312 
1313 //*************************************************************************************************
1315 template< typename MT, typename ST, bool SO >
1316 struct IsStrictlyLower< DMatScalarDivExpr<MT,ST,SO> >
1317  : public IsStrictlyLower<MT>
1318 {};
1320 //*************************************************************************************************
1321 
1322 
1323 
1324 
1325 //=================================================================================================
1326 //
1327 // ISUPPER SPECIALIZATIONS
1328 //
1329 //=================================================================================================
1330 
1331 //*************************************************************************************************
1333 template< typename MT, typename ST, bool SO >
1334 struct IsUpper< DMatScalarDivExpr<MT,ST,SO> >
1335  : public IsUpper<MT>
1336 {};
1338 //*************************************************************************************************
1339 
1340 
1341 
1342 
1343 //=================================================================================================
1344 //
1345 // ISSTRICTLYUPPER SPECIALIZATIONS
1346 //
1347 //=================================================================================================
1348 
1349 //*************************************************************************************************
1351 template< typename MT, typename ST, bool SO >
1352 struct IsStrictlyUpper< DMatScalarDivExpr<MT,ST,SO> >
1353  : public IsStrictlyUpper<MT>
1354 {};
1356 //*************************************************************************************************
1357 
1358 } // namespace blaze
1359 
1360 #endif
Header file for the UnderlyingNumeric type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatScalarDivExpr.h:582
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Data type constraint.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:71
ElementType_< MT > ET
Element type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:121
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Constraint on the data type.
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:343
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatScalarDivExpr.h:550
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatScalarDivExpr.h:187
#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
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:69
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatScalarDivExpr.h:560
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:354
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatScalarDivExpr.h:540
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.
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive publicly from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:97
decltype(auto) operator/(const DenseMatrix< MT, SO > &mat, ST scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:1070
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatScalarDivExpr.h:387
Base class for all matrix/scalar division expression templates.The MatScalarDivExpr class serves as a...
Definition: MatScalarDivExpr.h:66
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatScalarDivExpr.h:279
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
Header file for the serial shim.
#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
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatScalarDivExpr.h:519
#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
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatScalarDivExpr.h:614
ElementType ValueType
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:201
Iterator over the elements of the dense matrix.
Definition: DMatScalarDivExpr.h:196
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatScalarDivExpr.h:177
Header file for the And class template.
Expression object for divisions of a dense matrix by a scalar.The DMatScalarDivExpr class represents ...
Definition: DMatScalarDivExpr.h:113
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatScalarDivExpr.h:235
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:291
Header file for the Computation base class.
Header file for the UnderlyingElement type trait.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatScalarDivExpr.h:310
Header file for the RequiresEvaluation type trait.
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
ResultType_< MT > RT
Result type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:119
ConstIterator_< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:214
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
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: DMatScalarDivExpr.h:570
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:129
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatScalarDivExpr.h:247
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Header file for the DivExprTrait class template.
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:71
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatScalarDivExpr.h:604
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ElementType * PointerType
Pointer return type.
Definition: DMatScalarDivExpr.h:202
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
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 IsFloatingPoint type trait.
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
OppositeType_< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatScalarDivExpr.h:176
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
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
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatScalarDivExpr.h:300
Header file for the Or class template.
Expression object for dense matrix-scalar multiplications.The DMatScalarMultExpr class represents the...
Definition: DMatScalarMultExpr.h:107
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:376
#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
ReferenceType reference
Reference return type.
Definition: DMatScalarDivExpr.h:210
Header file for the DenseMatrix base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
DMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the DMatScalarDivExpr class.
Definition: DMatScalarDivExpr.h:458
Header file for all SIMD functionality.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: DMatScalarDivExpr.h:135
ElementType & ReferenceType
Reference return type.
Definition: DMatScalarDivExpr.h:203
Availability of a SIMD division for the given data types.Depending on the available instruction set (...
Definition: HasSIMDDiv.h:150
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DMatScalarDivExpr.h:190
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
IteratorType iterator_
Iterator to the current element.
Definition: DMatScalarDivExpr.h:430
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatScalarDivExpr.h:269
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatScalarDivExpr.h:200
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatScalarDivExpr.h:290
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DMatScalarDivExpr.h:178
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
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
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatScalarDivExpr.h:504
RightOperand scalar_
Scalar of the multiplication expression.
Definition: DMatScalarDivExpr.h:431
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the IsPadded type trait.
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatScalarDivExpr.h:258
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:292
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatScalarDivExpr.h:471
Header file for the IsNumeric type trait.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatScalarDivExpr.h:530
LeftOperand matrix_
Left-hand side dense matrix of the division expression.
Definition: DMatScalarDivExpr.h:622
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DMatScalarDivExpr.h:623
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DMatScalarDivExpr.h:223
Header file for run time assertion macros.
Header file for the division trait.
friend const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DMatScalarDivExpr.h:423
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DMatScalarDivExpr.h:175
CompositeType_< MT > CT
Composite type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:122
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
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
#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
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Compile time check for built-in data types.This type trait tests whether or not the given template pa...
Definition: IsBuiltin.h:75
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:82
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:321
IteratorCategory iterator_category
The iterator category.
Definition: DMatScalarDivExpr.h:207
ValueType value_type
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:208
Header file for the IsInvertible type trait.
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
PointerType pointer
Pointer return type.
Definition: DMatScalarDivExpr.h:209
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:81
ReturnType_< MT > RN
Return type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:120
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Header file for the HasSIMDDiv type trait.
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:112
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:66
Compile time logical &#39;or&#39; evaluation.The Or alias declaration performs at compile time a logical &#39;or&#39;...
Definition: Or.h:76
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatScalarDivExpr.h:399
Header file for the IsComplex type trait.
IfTrue_< useAssign, const ResultType, const DMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatScalarDivExpr.h:184
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatScalarDivExpr.h:411
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:383
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.
Header file for the MatScalarDivExpr base class.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatScalarDivExpr.h:486
Header file for the IsHermitian type trait.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:365
System settings for the inline keywords.
Header file for the Size type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DMatScalarDivExpr.h:181
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:95
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:332
Header file for the IsExpression type trait class.
Header file for the function trace functionality.
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatScalarDivExpr.h:594