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>
78 #include <blaze/system/Inline.h>
80 #include <blaze/util/Assert.h>
84 #include <blaze/util/EnableIf.h>
87 #include <blaze/util/InvalidType.h>
88 #include <blaze/util/mpl/And.h>
89 #include <blaze/util/mpl/If.h>
90 #include <blaze/util/mpl/Or.h>
91 #include <blaze/util/Types.h>
96 
97 
98 namespace blaze {
99 
100 //=================================================================================================
101 //
102 // CLASS DMATSCALARDIVEXPR
103 //
104 //=================================================================================================
105 
106 //*************************************************************************************************
113 template< typename MT // Type of the left-hand side dense matrix
114  , typename ST // Type of the right-hand side scalar value
115  , bool SO > // Storage order
117  : public MatScalarDivExpr< DenseMatrix< DMatScalarDivExpr<MT,ST,SO>, SO > >
118  , private Computation
119 {
120  private:
121  //**Type definitions****************************************************************************
122  using RT = ResultType_<MT>;
123  using RN = ReturnType_<MT>;
126  //**********************************************************************************************
127 
128  //**Return type evaluation**********************************************************************
130 
135  enum : bool { returnExpr = !IsTemporary<RN>::value };
136 
139  //**********************************************************************************************
140 
141  //**Serial evaluation strategy******************************************************************
143 
149  enum : bool { useAssign = IsComputation<MT>::value && RequiresEvaluation<MT>::value };
150 
152  template< typename MT2 >
154  struct UseAssign {
155  enum : bool { value = useAssign };
156  };
158  //**********************************************************************************************
159 
160  //**Parallel evaluation strategy****************************************************************
162 
168  template< typename MT2 >
169  struct UseSMPAssign {
170  enum : bool { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
171  };
173  //**********************************************************************************************
174 
175  public:
176  //**Type definitions****************************************************************************
182 
185 
188 
190  using LeftOperand = If_< IsExpression<MT>, const MT, const MT& >;
191 
193  using RightOperand = ST;
194  //**********************************************************************************************
195 
196  //**ConstIterator class definition**************************************************************
200  {
201  public:
202  //**Type definitions*************************************************************************
203  using IteratorCategory = std::random_access_iterator_tag;
208 
209  // STL iterator requirements
215 
218  //*******************************************************************************************
219 
220  //**Constructor******************************************************************************
226  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
227  : iterator_( iterator ) // Iterator to the current element
228  , scalar_ ( scalar ) // Scalar of the multiplication expression
229  {}
230  //*******************************************************************************************
231 
232  //**Addition assignment operator*************************************************************
238  inline ConstIterator& operator+=( size_t inc ) {
239  iterator_ += inc;
240  return *this;
241  }
242  //*******************************************************************************************
243 
244  //**Subtraction assignment operator**********************************************************
250  inline ConstIterator& operator-=( size_t dec ) {
251  iterator_ -= dec;
252  return *this;
253  }
254  //*******************************************************************************************
255 
256  //**Prefix increment operator****************************************************************
262  ++iterator_;
263  return *this;
264  }
265  //*******************************************************************************************
266 
267  //**Postfix increment operator***************************************************************
272  inline const ConstIterator operator++( int ) {
273  return ConstIterator( iterator_++ );
274  }
275  //*******************************************************************************************
276 
277  //**Prefix decrement operator****************************************************************
283  --iterator_;
284  return *this;
285  }
286  //*******************************************************************************************
287 
288  //**Postfix decrement operator***************************************************************
293  inline const ConstIterator operator--( int ) {
294  return ConstIterator( iterator_-- );
295  }
296  //*******************************************************************************************
297 
298  //**Element access operator******************************************************************
303  inline ReturnType operator*() const {
304  return *iterator_ / scalar_;
305  }
306  //*******************************************************************************************
307 
308  //**Load function****************************************************************************
313  inline auto load() const noexcept {
314  return iterator_.load() / set( scalar_ );
315  }
316  //*******************************************************************************************
317 
318  //**Equality operator************************************************************************
324  inline bool operator==( const ConstIterator& rhs ) const {
325  return iterator_ == rhs.iterator_;
326  }
327  //*******************************************************************************************
328 
329  //**Inequality operator**********************************************************************
335  inline bool operator!=( const ConstIterator& rhs ) const {
336  return iterator_ != rhs.iterator_;
337  }
338  //*******************************************************************************************
339 
340  //**Less-than operator***********************************************************************
346  inline bool operator<( const ConstIterator& rhs ) const {
347  return iterator_ < rhs.iterator_;
348  }
349  //*******************************************************************************************
350 
351  //**Greater-than operator********************************************************************
357  inline bool operator>( const ConstIterator& rhs ) const {
358  return iterator_ > rhs.iterator_;
359  }
360  //*******************************************************************************************
361 
362  //**Less-or-equal-than operator**************************************************************
368  inline bool operator<=( const ConstIterator& rhs ) const {
369  return iterator_ <= rhs.iterator_;
370  }
371  //*******************************************************************************************
372 
373  //**Greater-or-equal-than operator***********************************************************
379  inline bool operator>=( const ConstIterator& rhs ) const {
380  return iterator_ >= rhs.iterator_;
381  }
382  //*******************************************************************************************
383 
384  //**Subtraction operator*********************************************************************
390  inline DifferenceType operator-( const ConstIterator& rhs ) const {
391  return iterator_ - rhs.iterator_;
392  }
393  //*******************************************************************************************
394 
395  //**Addition operator************************************************************************
402  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
403  return ConstIterator( it.iterator_ + inc, it.scalar_ );
404  }
405  //*******************************************************************************************
406 
407  //**Addition operator************************************************************************
414  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
415  return ConstIterator( it.iterator_ + inc, it.scalar_ );
416  }
417  //*******************************************************************************************
418 
419  //**Subtraction operator*********************************************************************
426  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
427  return ConstIterator( it.iterator_ - dec, it.scalar_ );
428  }
429  //*******************************************************************************************
430 
431  private:
432  //**Member variables*************************************************************************
435  //*******************************************************************************************
436  };
437  //**********************************************************************************************
438 
439  //**Compilation flags***************************************************************************
441  enum : bool { simdEnabled = MT::simdEnabled &&
444  HasSIMDDiv<UnderlyingElement_<ET>,ST>::value ) };
445 
447  enum : bool { smpAssignable = MT::smpAssignable };
448  //**********************************************************************************************
449 
450  //**SIMD properties*****************************************************************************
452  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
453  //**********************************************************************************************
454 
455  //**Constructor*********************************************************************************
461  explicit inline DMatScalarDivExpr( const MT& matrix, ST scalar ) noexcept
462  : matrix_( matrix ) // Left-hand side dense matrix of the division expression
463  , scalar_( scalar ) // Right-hand side scalar of the division expression
464  {}
465  //**********************************************************************************************
466 
467  //**Access operator*****************************************************************************
474  inline ReturnType operator()( size_t i, size_t j ) const {
475  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
476  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
477  return matrix_(i,j) / scalar_;
478  }
479  //**********************************************************************************************
480 
481  //**At function*********************************************************************************
489  inline ReturnType at( size_t i, size_t j ) const {
490  if( i >= matrix_.rows() ) {
491  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
492  }
493  if( j >= matrix_.columns() ) {
494  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
495  }
496  return (*this)(i,j);
497  }
498  //**********************************************************************************************
499 
500  //**Load function*******************************************************************************
507  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
508  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
509  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
510  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
511  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
512  return matrix_.load(i,j) / set( scalar_ );
513  }
514  //**********************************************************************************************
515 
516  //**Begin function******************************************************************************
522  inline ConstIterator begin( size_t i ) const {
523  return ConstIterator( matrix_.begin(i), scalar_ );
524  }
525  //**********************************************************************************************
526 
527  //**End function********************************************************************************
533  inline ConstIterator end( size_t i ) const {
534  return ConstIterator( matrix_.end(i), scalar_ );
535  }
536  //**********************************************************************************************
537 
538  //**Rows function*******************************************************************************
543  inline size_t rows() const noexcept {
544  return matrix_.rows();
545  }
546  //**********************************************************************************************
547 
548  //**Columns function****************************************************************************
553  inline size_t columns() const noexcept {
554  return matrix_.columns();
555  }
556  //**********************************************************************************************
557 
558  //**Left operand access*************************************************************************
563  inline LeftOperand leftOperand() const noexcept {
564  return matrix_;
565  }
566  //**********************************************************************************************
567 
568  //**Right operand access************************************************************************
573  inline RightOperand rightOperand() const noexcept {
574  return scalar_;
575  }
576  //**********************************************************************************************
577 
578  //**********************************************************************************************
584  template< typename T >
585  inline bool canAlias( const T* alias ) const noexcept {
586  return IsExpression<MT>::value && matrix_.canAlias( alias );
587  }
588  //**********************************************************************************************
589 
590  //**********************************************************************************************
596  template< typename T >
597  inline bool isAliased( const T* alias ) const noexcept {
598  return matrix_.isAliased( alias );
599  }
600  //**********************************************************************************************
601 
602  //**********************************************************************************************
607  inline bool isAligned() const noexcept {
608  return matrix_.isAligned();
609  }
610  //**********************************************************************************************
611 
612  //**********************************************************************************************
617  inline bool canSMPAssign() const noexcept {
618  return matrix_.canSMPAssign() ||
619  ( rows() * columns() >= SMP_DMATSCALARMULT_THRESHOLD );
620  }
621  //**********************************************************************************************
622 
623  private:
624  //**Member variables****************************************************************************
627  //**********************************************************************************************
628 
629  //**Assignment to dense matrices****************************************************************
643  template< typename MT2 // Type of the target dense matrix
644  , bool SO2 > // Storage order of the target dense matrix
645  friend inline EnableIf_< UseAssign<MT2> >
646  assign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
647  {
649 
650  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
651  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
652 
653  assign( ~lhs, rhs.matrix_ );
654  assign( ~lhs, (~lhs) / rhs.scalar_ );
655  }
657  //**********************************************************************************************
658 
659  //**Assignment to sparse matrices***************************************************************
673  template< typename MT2 // Type of the target sparse matrix
674  , bool SO2 > // Storage order of the target sparse matrix
675  friend inline EnableIf_< UseAssign<MT2> >
676  assign( SparseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
677  {
679 
680  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
681  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
682 
683  assign( ~lhs, rhs.matrix_ );
684  (~lhs) /= rhs.scalar_;
685  }
687  //**********************************************************************************************
688 
689  //**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_< UseAssign<MT2> >
706  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
707  {
709 
713 
714  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
715  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
716 
717  const ResultType tmp( serial( rhs ) );
718  addAssign( ~lhs, tmp );
719  }
721  //**********************************************************************************************
722 
723  //**Addition assignment to sparse matrices******************************************************
724  // No special implementation for the addition assignment to sparse matrices.
725  //**********************************************************************************************
726 
727  //**Subtraction assignment to dense matrices****************************************************
741  template< typename MT2 // Type of the target dense matrix
742  , bool SO2 > // Storage order of the target dense matrix
743  friend inline EnableIf_< UseAssign<MT2> >
744  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
745  {
747 
751 
752  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
753  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
754 
755  const ResultType tmp( serial( rhs ) );
756  subAssign( ~lhs, tmp );
757  }
759  //**********************************************************************************************
760 
761  //**Subtraction assignment to sparse matrices***************************************************
762  // No special implementation for the subtraction assignment to sparse matrices.
763  //**********************************************************************************************
764 
765  //**Schur product assignment to dense matrices**************************************************
779  template< typename MT2 // Type of the target dense matrix
780  , bool SO2 > // Storage order of the target dense matrix
781  friend inline EnableIf_< UseAssign<MT2> >
782  schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
783  {
785 
789 
790  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
791  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
792 
793  const ResultType tmp( serial( rhs ) );
794  schurAssign( ~lhs, tmp );
795  }
797  //**********************************************************************************************
798 
799  //**Schur product assignment to sparse matrices*************************************************
800  // No special implementation for the Schur product assignment to sparse matrices.
801  //**********************************************************************************************
802 
803  //**Multiplication assignment to dense matrices*************************************************
804  // No special implementation for the multiplication assignment to dense matrices.
805  //**********************************************************************************************
806 
807  //**Multiplication assignment to sparse matrices************************************************
808  // No special implementation for the multiplication assignment to sparse matrices.
809  //**********************************************************************************************
810 
811  //**SMP assignment to dense matrices************************************************************
825  template< typename MT2 // Type of the target dense matrix
826  , bool SO2 > // Storage order of the target dense matrix
827  friend inline EnableIf_< UseSMPAssign<MT2> >
829  {
831 
832  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
833  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
834 
835  smpAssign( ~lhs, rhs.matrix_ );
836  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
837  }
839  //**********************************************************************************************
840 
841  //**SMP assignment to sparse matrices***********************************************************
855  template< typename MT2 // Type of the target sparse matrix
856  , bool SO2 > // Storage order of the target sparse matrix
857  friend inline EnableIf_< UseSMPAssign<MT2> >
859  {
861 
862  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
863  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
864 
865  smpAssign( ~lhs, rhs.matrix_ );
866  (~lhs) /= rhs.scalar_;
867  }
869  //**********************************************************************************************
870 
871  //**SMP addition assignment to dense matrices***************************************************
885  template< typename MT2 // Type of the target dense matrix
886  , bool SO2 > // Storage order of the target dense matrix
887  friend inline EnableIf_< UseSMPAssign<MT2> >
889  {
891 
895 
896  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
897  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
898 
899  const ResultType tmp( rhs );
900  smpAddAssign( ~lhs, tmp );
901  }
903  //**********************************************************************************************
904 
905  //**SMP addition assignment to sparse matrices**************************************************
906  // No special implementation for the SMP addition assignment to sparse matrices.
907  //**********************************************************************************************
908 
909  //**SMP subtraction assignment to dense matrices************************************************
923  template< typename MT2 // Type of the target dense matrix
924  , bool SO2 > // Storage order of the target dense matrix
925  friend inline EnableIf_< UseSMPAssign<MT2> >
927  {
929 
933 
934  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
935  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
936 
937  const ResultType tmp( rhs );
938  smpSubAssign( ~lhs, tmp );
939  }
941  //**********************************************************************************************
942 
943  //**SMP subtraction assignment to sparse matrices***********************************************
944  // No special implementation for the SMP subtraction assignment to sparse matrices.
945  //**********************************************************************************************
946 
947  //**SMP Schur product assignment to dense matrices**********************************************
961  template< typename MT2 // Type of the target dense matrix
962  , bool SO2 > // Storage order of the target dense matrix
963  friend inline EnableIf_< UseSMPAssign<MT2> >
965  {
967 
971 
972  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
973  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
974 
975  const ResultType tmp( rhs );
976  smpSchurAssign( ~lhs, tmp );
977  }
979  //**********************************************************************************************
980 
981  //**SMP Schur product assignment to sparse matrices*********************************************
982  // No special implementation for the SMP Schur product assignment to sparse matrices.
983  //**********************************************************************************************
984 
985  //**SMP multiplication assignment to dense matrices*********************************************
986  // No special implementation for the SMP multiplication assignment to dense matrices.
987  //**********************************************************************************************
988 
989  //**SMP multiplication assignment to sparse matrices********************************************
990  // No special implementation for the SMP multiplication assignment to sparse matrices.
991  //**********************************************************************************************
992 
993  //**Compile time checks*************************************************************************
1002  //**********************************************************************************************
1003 };
1004 //*************************************************************************************************
1005 
1006 
1007 
1008 
1009 //=================================================================================================
1010 //
1011 // GLOBAL BINARY ARITHMETIC OPERATORS
1012 //
1013 //=================================================================================================
1014 
1015 //*************************************************************************************************
1020 template< typename MT // Type of the left-hand side dense matrix
1021  , typename ST // Type of the right-hand side scalar
1022  , bool SO > // Storage order
1023 struct DMatScalarDivExprHelper
1024 {
1025  private:
1026  //**********************************************************************************************
1030  , IsBuiltin<ST> >
1033  , ST >;
1034  //**********************************************************************************************
1035 
1036  public:
1037  //**********************************************************************************************
1038  using Type = If_< IsInvertible<ScalarType>
1041  //**********************************************************************************************
1042 };
1044 //*************************************************************************************************
1045 
1046 
1047 //*************************************************************************************************
1069 template< typename MT // Type of the left-hand side dense matrix
1070  , bool SO // Storage order of the left-hand side dense matrix
1071  , typename ST // Type of the right-hand side scalar
1072  , typename = EnableIf_< IsNumeric<ST> > >
1073 inline decltype(auto) operator/( const DenseMatrix<MT,SO>& mat, ST scalar )
1074 {
1076 
1077  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
1078 
1079  using ReturnType = typename DMatScalarDivExprHelper<MT,ST,SO>::Type;
1080  using ScalarType = RightOperand_<ReturnType>;
1081 
1083  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
1084  }
1085  else {
1086  return ReturnType( ~mat, scalar );
1087  }
1088 }
1089 //*************************************************************************************************
1090 
1091 
1092 
1093 
1094 //=================================================================================================
1095 //
1096 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
1097 //
1098 //=================================================================================================
1099 
1100 //*************************************************************************************************
1113 template< typename MT // Type of the dense matrix of the left-hand side expression
1114  , typename ST1 // Type of the scalar of the left-hand side expression
1115  , bool SO // Storage order of the dense matrix
1116  , typename ST2 // Type of the right-hand side scalar
1118 inline decltype(auto) operator*( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1119 {
1121 
1122  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 //*************************************************************************************************
1141 template< typename ST1 // Type of the left-hand side scalar
1142  , typename MT // Type of the dense matrix of the right-hand side expression
1143  , typename ST2 // Type of the scalar of the right-hand side expression
1144  , bool SO // Storage order of the dense matrix
1145  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
1146 inline decltype(auto) operator*( ST1 scalar, const DMatScalarDivExpr<MT,ST2,SO>& mat )
1147 {
1149 
1150  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1151 }
1153 //*************************************************************************************************
1154 
1155 
1156 //*************************************************************************************************
1169 template< typename MT // Type of the dense matrix of the left-hand side expression
1170  , typename ST1 // Type of the scalar of the left-hand side expression
1171  , bool SO // Storage order of the dense matrix
1172  , typename ST2 // Type of the right-hand side scalar
1173  , typename = EnableIf_< IsNumeric<ST2> > >
1174 inline decltype(auto) operator/( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1175 {
1177 
1178  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1179 
1180  using MultType = MultTrait_<ST1,ST2>;
1181  using ReturnType = typename DMatScalarDivExprHelper<MT,MultType,SO>::Type;
1182  using ScalarType = RightOperand_<ReturnType>;
1183 
1185  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1186  }
1187  else {
1188  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1189  }
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 
1196 
1197 //=================================================================================================
1198 //
1199 // ROWS SPECIALIZATIONS
1200 //
1201 //=================================================================================================
1202 
1203 //*************************************************************************************************
1205 template< typename MT, typename ST, bool SO >
1206 struct Rows< DMatScalarDivExpr<MT,ST,SO> >
1207  : public Rows<MT>
1208 {};
1210 //*************************************************************************************************
1211 
1212 
1213 
1214 
1215 //=================================================================================================
1216 //
1217 // COLUMNS SPECIALIZATIONS
1218 //
1219 //=================================================================================================
1220 
1221 //*************************************************************************************************
1223 template< typename MT, typename ST, bool SO >
1224 struct Columns< DMatScalarDivExpr<MT,ST,SO> >
1225  : public Columns<MT>
1226 {};
1228 //*************************************************************************************************
1229 
1230 
1231 
1232 
1233 //=================================================================================================
1234 //
1235 // ISALIGNED SPECIALIZATIONS
1236 //
1237 //=================================================================================================
1238 
1239 //*************************************************************************************************
1241 template< typename MT, typename ST, bool SO >
1242 struct IsAligned< DMatScalarDivExpr<MT,ST,SO> >
1243  : public BoolConstant< IsAligned<MT>::value >
1244 {};
1246 //*************************************************************************************************
1247 
1248 
1249 
1250 
1251 //=================================================================================================
1252 //
1253 // ISPADDED SPECIALIZATIONS
1254 //
1255 //=================================================================================================
1256 
1257 //*************************************************************************************************
1259 template< typename MT, typename ST, bool SO >
1260 struct IsPadded< DMatScalarDivExpr<MT,ST,SO> >
1261  : public BoolConstant< IsPadded<MT>::value >
1262 {};
1264 //*************************************************************************************************
1265 
1266 
1267 
1268 
1269 //=================================================================================================
1270 //
1271 // ISSYMMETRIC SPECIALIZATIONS
1272 //
1273 //=================================================================================================
1274 
1275 //*************************************************************************************************
1277 template< typename MT, typename ST, bool SO >
1278 struct IsSymmetric< DMatScalarDivExpr<MT,ST,SO> >
1279  : public BoolConstant< IsSymmetric<MT>::value >
1280 {};
1282 //*************************************************************************************************
1283 
1284 
1285 
1286 
1287 //=================================================================================================
1288 //
1289 // ISHERMITIAN SPECIALIZATIONS
1290 //
1291 //=================================================================================================
1292 
1293 //*************************************************************************************************
1295 template< typename MT, typename ST, bool SO >
1296 struct IsHermitian< DMatScalarDivExpr<MT,ST,SO> >
1297  : public BoolConstant< IsHermitian<MT>::value >
1298 {};
1300 //*************************************************************************************************
1301 
1302 
1303 
1304 
1305 //=================================================================================================
1306 //
1307 // ISLOWER SPECIALIZATIONS
1308 //
1309 //=================================================================================================
1310 
1311 //*************************************************************************************************
1313 template< typename MT, typename ST, bool SO >
1314 struct IsLower< DMatScalarDivExpr<MT,ST,SO> >
1315  : public BoolConstant< IsLower<MT>::value >
1316 {};
1318 //*************************************************************************************************
1319 
1320 
1321 
1322 
1323 //=================================================================================================
1324 //
1325 // ISSTRICTLYLOWER SPECIALIZATIONS
1326 //
1327 //=================================================================================================
1328 
1329 //*************************************************************************************************
1331 template< typename MT, typename ST, bool SO >
1332 struct IsStrictlyLower< DMatScalarDivExpr<MT,ST,SO> >
1333  : public BoolConstant< IsStrictlyLower<MT>::value >
1334 {};
1336 //*************************************************************************************************
1337 
1338 
1339 
1340 
1341 //=================================================================================================
1342 //
1343 // ISUPPER SPECIALIZATIONS
1344 //
1345 //=================================================================================================
1346 
1347 //*************************************************************************************************
1349 template< typename MT, typename ST, bool SO >
1350 struct IsUpper< DMatScalarDivExpr<MT,ST,SO> >
1351  : public BoolConstant< IsUpper<MT>::value >
1352 {};
1354 //*************************************************************************************************
1355 
1356 
1357 
1358 
1359 //=================================================================================================
1360 //
1361 // ISSTRICTLYUPPER SPECIALIZATIONS
1362 //
1363 //=================================================================================================
1364 
1365 //*************************************************************************************************
1367 template< typename MT, typename ST, bool SO >
1368 struct IsStrictlyUpper< DMatScalarDivExpr<MT,ST,SO> >
1369  : public BoolConstant< IsStrictlyUpper<MT>::value >
1370 {};
1372 //*************************************************************************************************
1373 
1374 } // namespace blaze
1375 
1376 #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:585
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:72
ElementType_< MT > ET
Element type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:124
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:346
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatScalarDivExpr.h:553
If_< IsExpression< MT >, const MT, const MT &> LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatScalarDivExpr.h:190
#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:70
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense matrix operand.
Definition: DMatScalarDivExpr.h:563
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:357
Header file for the Rows type trait.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatScalarDivExpr.h:543
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:1073
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatScalarDivExpr.h:390
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:282
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:522
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
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatScalarDivExpr.h:617
ElementType ValueType
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:204
Iterator over the elements of the dense matrix.
Definition: DMatScalarDivExpr.h:199
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatScalarDivExpr.h:180
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:116
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatScalarDivExpr.h:238
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
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:88
auto load() const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatScalarDivExpr.h:313
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:122
ConstIterator_< MT > IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:217
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:573
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
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatScalarDivExpr.h:250
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:72
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatScalarDivExpr.h:607
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:205
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:57
#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:179
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:303
Header file for the Or class template.
Expression object for dense matrix-scalar multiplications.The DMatScalarMultExpr class represents the...
Definition: DMatScalarMultExpr.h:110
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:379
#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:213
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
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
DMatScalarDivExpr(const MT &matrix, ST scalar) noexcept
Constructor for the DMatScalarDivExpr class.
Definition: DMatScalarDivExpr.h:461
Header file for all SIMD functionality.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: DMatScalarDivExpr.h:138
ElementType & ReferenceType
Reference return type.
Definition: DMatScalarDivExpr.h:206
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:193
#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:433
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatScalarDivExpr.h:272
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatScalarDivExpr.h:203
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatScalarDivExpr.h:293
ElementType_< ResultType > ElementType
Resulting element type.
Definition: DMatScalarDivExpr.h:181
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:507
RightOperand scalar_
Scalar of the multiplication expression.
Definition: DMatScalarDivExpr.h:434
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:261
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatScalarDivExpr.h:474
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:533
LeftOperand matrix_
Left-hand side dense matrix of the division expression.
Definition: DMatScalarDivExpr.h:625
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DMatScalarDivExpr.h:626
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DMatScalarDivExpr.h:226
Header file for run time assertion macros.
Utility type for generic codes.
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:426
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: DMatScalarDivExpr.h:178
CompositeType_< MT > CT
Composite type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:125
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:83
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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:324
IteratorCategory iterator_category
The iterator category.
Definition: DMatScalarDivExpr.h:210
ValueType value_type
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:211
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:212
#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:123
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:3082
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 or evaluation.The Or alias declaration performs at compile time a logical or (&#39;&&&#3...
Definition: Or.h:76
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatScalarDivExpr.h:402
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
Header file for the IsComplex type trait.
IfTrue_< useAssign, const ResultType, const DMatScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatScalarDivExpr.h:187
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatScalarDivExpr.h:414
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:489
Header file for the IsHermitian type trait.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:368
System settings for the inline keywords.
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:184
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:335
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:597