All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
50 #include <blaze/math/Intrinsics.h>
69 #include <blaze/util/Assert.h>
74 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/InvalidType.h>
77 #include <blaze/util/SelectType.h>
78 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS DMATSCALARDIVEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename MT // Type of the left-hand side dense matrix
100  , typename ST // Type of the right-hand side scalar value
101  , bool SO > // Storage order
102 class DMatScalarDivExpr : public DenseMatrix< DMatScalarDivExpr<MT,ST,SO>, SO >
103  , private MatScalarDivExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename MT::ResultType RT;
109  typedef typename MT::ReturnType RN;
110  typedef typename MT::ElementType ET;
111  typedef typename MT::CompositeType CT;
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  enum { returnExpr = !IsTemporary<RN>::value };
122 
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
136 
138  template< typename MT2 >
140  struct UseAssign {
141  enum { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**Parallel evaluation strategy****************************************************************
148 
154  template< typename MT2 >
155  struct UseSMPAssign {
156  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
157  };
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
169 
172 
175 
177  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
178 
180  typedef ST RightOperand;
181  //**********************************************************************************************
182 
183  //**ConstIterator class definition**************************************************************
187  {
188  public:
189  //**Type definitions*************************************************************************
190  typedef std::random_access_iterator_tag IteratorCategory;
195 
196  // STL iterator requirements
202 
204  typedef typename MT::ConstIterator IteratorType;
205  //*******************************************************************************************
206 
207  //**Constructor******************************************************************************
213  explicit inline ConstIterator( IteratorType iterator, RightOperand scalar )
214  : iterator_( iterator ) // Iterator to the current element
215  , scalar_ ( scalar ) // Scalar of the multiplication expression
216  {}
217  //*******************************************************************************************
218 
219  //**Addition assignment operator*************************************************************
225  inline ConstIterator& operator+=( size_t inc ) {
226  iterator_ += inc;
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Subtraction assignment operator**********************************************************
237  inline ConstIterator& operator-=( size_t dec ) {
238  iterator_ -= dec;
239  return *this;
240  }
241  //*******************************************************************************************
242 
243  //**Prefix increment operator****************************************************************
249  ++iterator_;
250  return *this;
251  }
252  //*******************************************************************************************
253 
254  //**Postfix increment operator***************************************************************
259  inline const ConstIterator operator++( int ) {
260  return ConstIterator( iterator_++ );
261  }
262  //*******************************************************************************************
263 
264  //**Prefix decrement operator****************************************************************
270  --iterator_;
271  return *this;
272  }
273  //*******************************************************************************************
274 
275  //**Postfix decrement operator***************************************************************
280  inline const ConstIterator operator--( int ) {
281  return ConstIterator( iterator_-- );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
290  inline ReturnType operator*() const {
291  return *iterator_ / scalar_;
292  }
293  //*******************************************************************************************
294 
295  //**Load function****************************************************************************
300  inline IntrinsicType load() const {
301  return iterator_.load() / set( scalar_ );
302  }
303  //*******************************************************************************************
304 
305  //**Equality operator************************************************************************
311  inline bool operator==( const ConstIterator& rhs ) const {
312  return iterator_ == rhs.iterator_;
313  }
314  //*******************************************************************************************
315 
316  //**Inequality operator**********************************************************************
322  inline bool operator!=( const ConstIterator& rhs ) const {
323  return iterator_ != rhs.iterator_;
324  }
325  //*******************************************************************************************
326 
327  //**Less-than operator***********************************************************************
333  inline bool operator<( const ConstIterator& rhs ) const {
334  return iterator_ < rhs.iterator_;
335  }
336  //*******************************************************************************************
337 
338  //**Greater-than operator********************************************************************
344  inline bool operator>( const ConstIterator& rhs ) const {
345  return iterator_ > rhs.iterator_;
346  }
347  //*******************************************************************************************
348 
349  //**Less-or-equal-than operator**************************************************************
355  inline bool operator<=( const ConstIterator& rhs ) const {
356  return iterator_ <= rhs.iterator_;
357  }
358  //*******************************************************************************************
359 
360  //**Greater-or-equal-than operator***********************************************************
366  inline bool operator>=( const ConstIterator& rhs ) const {
367  return iterator_ >= rhs.iterator_;
368  }
369  //*******************************************************************************************
370 
371  //**Subtraction operator*********************************************************************
377  inline DifferenceType operator-( const ConstIterator& rhs ) const {
378  return iterator_ - rhs.iterator_;
379  }
380  //*******************************************************************************************
381 
382  //**Addition operator************************************************************************
389  friend inline const ConstIterator operator+( const ConstIterator& it, size_t inc ) {
390  return ConstIterator( it.iterator_ + inc );
391  }
392  //*******************************************************************************************
393 
394  //**Addition operator************************************************************************
401  friend inline const ConstIterator operator+( size_t inc, const ConstIterator& it ) {
402  return ConstIterator( it.iterator_ + inc );
403  }
404  //*******************************************************************************************
405 
406  //**Subtraction operator*********************************************************************
413  friend inline const ConstIterator operator-( const ConstIterator& it, size_t dec ) {
414  return ConstIterator( it.iterator_ - dec );
415  }
416  //*******************************************************************************************
417 
418  private:
419  //**Member variables*************************************************************************
422  //*******************************************************************************************
423  };
424  //**********************************************************************************************
425 
426  //**Compilation flags***************************************************************************
428  enum { vectorizable = MT::vectorizable &&
431 
433  enum { smpAssignable = MT::smpAssignable };
434  //**********************************************************************************************
435 
436  //**Constructor*********************************************************************************
442  explicit inline DMatScalarDivExpr( const MT& matrix, ST scalar )
443  : matrix_( matrix ) // Left-hand side dense matrix of the division expression
444  , scalar_( scalar ) // Right-hand side scalar of the division expression
445  {}
446  //**********************************************************************************************
447 
448  //**Access operator*****************************************************************************
455  inline ReturnType operator()( size_t i, size_t j ) const {
456  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
457  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
458  return matrix_(i,j) / scalar_;
459  }
460  //**********************************************************************************************
461 
462  //**Load function*******************************************************************************
469  inline IntrinsicType load( size_t i, size_t j ) const {
470  typedef IntrinsicTrait<ElementType> IT;
471  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
472  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
473  BLAZE_INTERNAL_ASSERT( !SO || ( i % IT::size == 0UL ), "Invalid row access index" );
474  BLAZE_INTERNAL_ASSERT( SO || ( j % IT::size == 0UL ), "Invalid column access index" );
475  const IntrinsicType xmm1( matrix_.load(i,j) );
476  const IntrinsicType xmm2( set( scalar_ ) );
477  return xmm1 / xmm2;
478  }
479  //**********************************************************************************************
480 
481  //**Begin function******************************************************************************
487  inline ConstIterator begin( size_t i ) const {
488  return ConstIterator( matrix_.begin(i), scalar_ );
489  }
490  //**********************************************************************************************
491 
492  //**End function********************************************************************************
498  inline ConstIterator end( size_t i ) const {
499  return ConstIterator( matrix_.end(i), scalar_ );
500  }
501  //**********************************************************************************************
502 
503  //**Rows function*******************************************************************************
508  inline size_t rows() const {
509  return matrix_.rows();
510  }
511  //**********************************************************************************************
512 
513  //**Columns function****************************************************************************
518  inline size_t columns() const {
519  return matrix_.columns();
520  }
521  //**********************************************************************************************
522 
523  //**Left operand access*************************************************************************
528  inline LeftOperand leftOperand() const {
529  return matrix_;
530  }
531  //**********************************************************************************************
532 
533  //**Right operand access************************************************************************
538  inline RightOperand rightOperand() const {
539  return scalar_;
540  }
541  //**********************************************************************************************
542 
543  //**********************************************************************************************
549  template< typename T >
550  inline bool canAlias( const T* alias ) const {
551  return IsComputation<MT>::value && matrix_.canAlias( alias );
552  }
553  //**********************************************************************************************
554 
555  //**********************************************************************************************
561  template< typename T >
562  inline bool isAliased( const T* alias ) const {
563  return matrix_.isAliased( alias );
564  }
565  //**********************************************************************************************
566 
567  //**********************************************************************************************
572  inline bool isAligned() const {
573  return matrix_.isAligned();
574  }
575  //**********************************************************************************************
576 
577  //**********************************************************************************************
582  inline bool canSMPAssign() const {
583  return matrix_.canSMPAssign() ||
584  ( ( ( SO == rowMajor ) ? rows() : columns() ) > SMP_DMATSCALARMULT_THRESHOLD );
585  }
586  //**********************************************************************************************
587 
588  private:
589  //**Member variables****************************************************************************
592  //**********************************************************************************************
593 
594  //**Assignment to dense matrices****************************************************************
608  template< typename MT2 // Type of the target dense matrix
609  , bool SO2 > // Storage order of the target dense matrix
610  friend inline typename EnableIf< UseAssign<MT2> >::Type
611  assign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
612  {
614 
615  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
616  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
617 
618  assign( ~lhs, rhs.matrix_ );
619  assign( ~lhs, (~lhs) / rhs.scalar_ );
620  }
622  //**********************************************************************************************
623 
624  //**Assignment to sparse matrices***************************************************************
638  template< typename MT2 // Type of the target sparse matrix
639  , bool SO2 > // Storage order of the target sparse matrix
640  friend inline typename EnableIf< UseAssign<MT2> >::Type
642  {
644 
645  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
646  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
647 
648  assign( ~lhs, rhs.matrix_ );
649  (~lhs) /= rhs.scalar_;
650  }
652  //**********************************************************************************************
653 
654  //**Addition assignment to dense matrices*******************************************************
668  template< typename MT2 // Type of the target dense matrix
669  , bool SO2 > // Storage order of the target dense matrix
670  friend inline typename EnableIf< UseAssign<MT2> >::Type
671  addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
672  {
674 
678 
679  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
680  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
681 
682  const ResultType tmp( serial( rhs ) );
683  addAssign( ~lhs, tmp );
684  }
686  //**********************************************************************************************
687 
688  //**Addition assignment to sparse matrices******************************************************
689  // No special implementation for the addition assignment to sparse matrices.
690  //**********************************************************************************************
691 
692  //**Subtraction assignment to dense matrices****************************************************
706  template< typename MT2 // Type of the target dense matrix
707  , bool SO2 > // Storage order of the target dense matrix
708  friend inline typename EnableIf< UseAssign<MT2> >::Type
709  subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
710  {
712 
716 
717  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
718  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
719 
720  const ResultType tmp( serial( rhs ) );
721  subAssign( ~lhs, tmp );
722  }
724  //**********************************************************************************************
725 
726  //**Subtraction assignment to sparse matrices***************************************************
727  // No special implementation for the subtraction assignment to sparse matrices.
728  //**********************************************************************************************
729 
730  //**Multiplication assignment to dense matrices*************************************************
731  // No special implementation for the multiplication assignment to dense matrices.
732  //**********************************************************************************************
733 
734  //**Multiplication assignment to sparse matrices************************************************
735  // No special implementation for the multiplication assignment to sparse matrices.
736  //**********************************************************************************************
737 
738  //**SMP assignment to dense matrices************************************************************
752  template< typename MT2 // Type of the target dense matrix
753  , bool SO2 > // Storage order of the target dense matrix
754  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
755  smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
756  {
758 
759  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
760  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
761 
762  smpAssign( ~lhs, rhs.matrix_ );
763  smpAssign( ~lhs, (~lhs) / rhs.scalar_ );
764  }
766  //**********************************************************************************************
767 
768  //**SMP assignment to sparse matrices***********************************************************
782  template< typename MT2 // Type of the target sparse matrix
783  , bool SO2 > // Storage order of the target sparse matrix
784  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
785  smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
786  {
788 
789  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
790  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
791 
792  smpAssign( ~lhs, rhs.matrix_ );
793  (~lhs) /= rhs.scalar_;
794  }
796  //**********************************************************************************************
797 
798  //**SMP addition assignment to dense matrices***************************************************
812  template< typename MT2 // Type of the target dense matrix
813  , bool SO2 > // Storage order of the target dense matrix
814  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
815  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
816  {
818 
822 
823  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
824  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
825 
826  const ResultType tmp( rhs );
827  smpAddAssign( ~lhs, tmp );
828  }
830  //**********************************************************************************************
831 
832  //**SMP addition assignment to sparse matrices**************************************************
833  // No special implementation for the SMP addition assignment to sparse matrices.
834  //**********************************************************************************************
835 
836  //**SMP subtraction assignment to dense matrices************************************************
850  template< typename MT2 // Type of the target dense matrix
851  , bool SO2 > // Storage order of the target dense matrix
852  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
853  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatScalarDivExpr& rhs )
854  {
856 
860 
861  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
862  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
863 
864  const ResultType tmp( rhs );
865  smpSubAssign( ~lhs, tmp );
866  }
868  //**********************************************************************************************
869 
870  //**SMP subtraction assignment to sparse matrices***********************************************
871  // No special implementation for the SMP subtraction assignment to sparse matrices.
872  //**********************************************************************************************
873 
874  //**SMP multiplication assignment to dense matrices*********************************************
875  // No special implementation for the SMP multiplication assignment to dense matrices.
876  //**********************************************************************************************
877 
878  //**SMP multiplication assignment to sparse matrices********************************************
879  // No special implementation for the SMP multiplication assignment to sparse matrices.
880  //**********************************************************************************************
881 
882  //**Compile time checks*************************************************************************
891  //**********************************************************************************************
892 };
893 //*************************************************************************************************
894 
895 
896 
897 
898 //=================================================================================================
899 //
900 // GLOBAL BINARY ARITHMETIC OPERATORS
901 //
902 //=================================================================================================
903 
904 //*************************************************************************************************
926 template< typename T1 // Type of the left-hand side dense matrix
927  , bool SO // Storage order of the left-hand side dense matrix
928  , typename T2 > // Type of the right-hand side scalar
929 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
930  operator/( const DenseMatrix<T1,SO>& mat, T2 scalar )
931 {
933 
934  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
935 
936  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
937  typedef typename ReturnType::RightOperand ScalarType;
938 
940  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
941  }
942  else {
943  return ReturnType( ~mat, scalar );
944  }
945 }
946 //*************************************************************************************************
947 
948 
949 
950 
951 //=================================================================================================
952 //
953 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
954 //
955 //=================================================================================================
956 
957 //*************************************************************************************************
970 template< typename MT // Type of the dense matrix of the left-hand side expression
971  , typename ST1 // Type of the scalar of the left-hand side expression
972  , bool SO // Storage order of the dense matrix
973  , typename ST2 > // Type of the right-hand side scalar
974 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST2,ST1>::Type >
975  , typename MultExprTrait< DMatScalarDivExpr<MT,ST1,SO>, ST2 >::Type >::Type
976  operator*( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
977 {
979 
980  return mat.leftOperand() * ( scalar / mat.rightOperand() );
981 }
983 //*************************************************************************************************
984 
985 
986 //*************************************************************************************************
999 template< typename ST1 // Type of the left-hand side scalar
1000  , typename MT // Type of the dense matrix of the right-hand side expression
1001  , typename ST2 // Type of the scalar of the right-hand side expression
1002  , bool SO > // Storage order of the dense matrix
1003 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST1,ST2>::Type >
1004  , typename MultExprTrait< ST1, DMatScalarDivExpr<MT,ST2,SO> >::Type >::Type
1005  operator*( ST1 scalar, const DMatScalarDivExpr<MT,ST2,SO>& mat )
1006 {
1008 
1009  return mat.leftOperand() * ( scalar / mat.rightOperand() );
1010 }
1012 //*************************************************************************************************
1013 
1014 
1015 //*************************************************************************************************
1028 template< typename MT // Type of the dense matrix of the left-hand side expression
1029  , typename ST1 // Type of the scalar of the left-hand side expression
1030  , bool SO // Storage order of the dense matrix
1031  , typename ST2 > // Type of the right-hand side scalar
1032 inline const typename EnableIf< IsNumeric<ST2>
1033  , typename DivExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
1034  operator/( const DMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
1035 {
1037 
1038  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1039 
1040  typedef typename MultTrait<ST1,ST2>::Type MultType;
1041  typedef typename DivExprTrait<MT,MultType>::Type ReturnType;
1042  typedef typename ReturnType::RightOperand ScalarType;
1043 
1044  if( IsMultExpr<ReturnType>::value ) {
1045  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
1046  }
1047  else {
1048  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
1049  }
1050 }
1052 //*************************************************************************************************
1053 
1054 
1055 
1056 
1057 //=================================================================================================
1058 //
1059 // DMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1060 //
1061 //=================================================================================================
1062 
1063 //*************************************************************************************************
1065 template< typename MT, typename ST1, typename ST2 >
1066 struct DMatScalarMultExprTrait< DMatScalarDivExpr<MT,ST1,false>, ST2 >
1067 {
1068  private:
1069  //**********************************************************************************************
1070  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1071  //**********************************************************************************************
1072 
1073  //**********************************************************************************************
1074  typedef typename DMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1075  typedef DMatScalarMultExpr< DMatScalarDivExpr<MT,ST1,false>, ST2, false > T2;
1076  //**********************************************************************************************
1077 
1078  public:
1079  //**********************************************************************************************
1080  typedef typename SelectType< IsDenseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1081  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1082  , typename SelectType<condition,T1,T2>::Type
1083  , INVALID_TYPE >::Type Type;
1084  //**********************************************************************************************
1085 };
1087 //*************************************************************************************************
1088 
1089 
1090 
1091 
1092 //=================================================================================================
1093 //
1094 // TDMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1095 //
1096 //=================================================================================================
1097 
1098 //*************************************************************************************************
1100 template< typename MT, typename ST1, typename ST2 >
1101 struct TDMatScalarMultExprTrait< DMatScalarDivExpr<MT,ST1,true>, ST2 >
1102 {
1103  private:
1104  //**********************************************************************************************
1105  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1106  //**********************************************************************************************
1107 
1108  //**********************************************************************************************
1109  typedef typename DMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1110  typedef DMatScalarMultExpr< DMatScalarDivExpr<MT,ST1,true>, ST2, true > T2;
1111  //**********************************************************************************************
1112 
1113  public:
1114  //**********************************************************************************************
1115  typedef typename SelectType< IsDenseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1116  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1117  , typename SelectType<condition,T1,T2>::Type
1118  , INVALID_TYPE >::Type Type;
1119  //**********************************************************************************************
1120 };
1122 //*************************************************************************************************
1123 
1124 
1125 
1126 
1127 //=================================================================================================
1128 //
1129 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
1130 //
1131 //=================================================================================================
1132 
1133 //*************************************************************************************************
1135 template< typename MT, typename ST, bool SO, bool AF >
1136 struct SubmatrixExprTrait< DMatScalarDivExpr<MT,ST,SO>, AF >
1137 {
1138  public:
1139  //**********************************************************************************************
1140  typedef typename DivExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type, ST >::Type Type;
1141  //**********************************************************************************************
1142 };
1144 //*************************************************************************************************
1145 
1146 
1147 
1148 
1149 //=================================================================================================
1150 //
1151 // ROWEXPRTRAIT SPECIALIZATIONS
1152 //
1153 //=================================================================================================
1154 
1155 //*************************************************************************************************
1157 template< typename MT, typename ST, bool SO >
1158 struct RowExprTrait< DMatScalarDivExpr<MT,ST,SO> >
1159 {
1160  public:
1161  //**********************************************************************************************
1162  typedef typename DivExprTrait< typename RowExprTrait<const MT>::Type, ST >::Type Type;
1163  //**********************************************************************************************
1164 };
1166 //*************************************************************************************************
1167 
1168 
1169 
1170 
1171 //=================================================================================================
1172 //
1173 // COLUMNEXPRTRAIT SPECIALIZATIONS
1174 //
1175 //=================================================================================================
1176 
1177 //*************************************************************************************************
1179 template< typename MT, typename ST, bool SO >
1180 struct ColumnExprTrait< DMatScalarDivExpr<MT,ST,SO> >
1181 {
1182  public:
1183  //**********************************************************************************************
1184  typedef typename DivExprTrait< typename ColumnExprTrait<const MT>::Type, ST >::Type Type;
1185  //**********************************************************************************************
1186 };
1188 //*************************************************************************************************
1189 
1190 } // namespace blaze
1191 
1192 #endif
Pointer difference type of the Blaze library.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: DMatScalarDivExpr.h:582
Data type constraint.
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
Constraint on the data type.
#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
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: DMatScalarDivExpr.h:538
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4329
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:930
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 or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:90
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
ValueType value_type
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:198
Base class for all matrix/scalar divsion expression templates.The MatScalarDivExpr class serves as a ...
Definition: MatScalarDivExpr.h:65
ConstIterator & operator--()
Pre-decrement operator.
Definition: DMatScalarDivExpr.h:269
#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:242
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:322
#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:79
Header file for the ColumnExprTrait class template.
IntrinsicType load() const
Access to the intrinsic elements of the matrix.
Definition: DMatScalarDivExpr.h:300
Header file for the IsSame and IsStrictlySame type traits.
const size_t SMP_DMATSCALARMULT_THRESHOLD
SMP dense matrix/scalar multiplication/division threshold.This threshold specifies when a dense matri...
Definition: Thresholds.h:811
DMatScalarDivExpr< MT, ST, SO > This
Type of this DMatScalarDivExpr instance.
Definition: DMatScalarDivExpr.h:163
bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:344
Header file for the IsColumnMajorMatrix type trait.
MT::CompositeType CT
Composite type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:111
Iterator over the elements of the dense matrix.
Definition: DMatScalarDivExpr.h:186
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DMatScalarDivExpr.h:377
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
Expression object for divisions of a dense matrix by a scalar.The DMatScalarDivExpr class represents ...
Definition: DMatScalarDivExpr.h:102
ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DMatScalarDivExpr.h:225
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:158
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DMatScalarDivExpr.h:562
Header file for the RequiresEvaluation type trait.
ElementType ValueType
Type of the underlying elements.
Definition: DMatScalarDivExpr.h:191
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
ResultType::ElementType ElementType
Resulting element type.
Definition: DMatScalarDivExpr.h:167
Constraint on the data type.
ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DMatScalarDivExpr.h:237
Header file for the DivExprTrait class template.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DMatScalarDivExpr.h:194
Evaluation of the resulting expression type of a division.Via this type trait it is possible to evalu...
Definition: DivExprTrait.h:87
MT::ResultType RT
Result type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:108
Constraint on the data type.
Header file for the MultExprTrait class template.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DMatScalarDivExpr.h:171
void smpAddAssign(DenseMatrix< 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:122
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:253
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
DivTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: DMatScalarDivExpr.h:164
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
ElementType & ReferenceType
Reference return type.
Definition: DMatScalarDivExpr.h:193
IntrinsicType load(size_t i, size_t j) const
Access to the intrinsic elements of the matrix.
Definition: DMatScalarDivExpr.h:469
Header file for the IsFloatingPoint type trait.
ReferenceType reference
Reference return type.
Definition: DMatScalarDivExpr.h:200
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Header file for the DenseMatrix base class.
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:271
#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:89
IteratorType iterator_
Iterator to the current element.
Definition: DMatScalarDivExpr.h:420
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
const ConstIterator operator++(int)
Post-increment operator.
Definition: DMatScalarDivExpr.h:259
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatScalarDivExpr.h:165
const ConstIterator operator--(int)
Post-decrement operator.
Definition: DMatScalarDivExpr.h:280
Constraints on the storage order of matrix types.
MT::ElementType ET
Element type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:110
PointerType pointer
Pointer return type.
Definition: DMatScalarDivExpr.h:199
ElementType * PointerType
Pointer return type.
Definition: DMatScalarDivExpr.h:192
RightOperand scalar_
Scalar of the multiplication expression.
Definition: DMatScalarDivExpr.h:421
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the IsDenseMatrix type trait.
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DMatScalarDivExpr.h:124
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the BaseElementType type trait.
ConstIterator & operator++()
Pre-increment operator.
Definition: DMatScalarDivExpr.h:248
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Header file for the IsNumeric type trait.
DMatScalarDivExpr(const MT &matrix, ST scalar)
Constructor for the DMatScalarDivExpr class.
Definition: DMatScalarDivExpr.h:442
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite type of the left-hand side dense matrix expression.
Definition: DMatScalarDivExpr.h:177
bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:366
LeftOperand matrix_
Left-hand side dense matrix of the division expression.
Definition: DMatScalarDivExpr.h:590
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DMatScalarDivExpr.h:550
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: DMatScalarDivExpr.h:591
ConstIterator(IteratorType iterator, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: DMatScalarDivExpr.h:213
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
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:413
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:301
SelectType< useAssign, const ResultType, const DMatScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: DMatScalarDivExpr.h:174
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
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:79
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:331
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatScalarDivExpr.h:508
IteratorCategory iterator_category
The iterator category.
Definition: DMatScalarDivExpr.h:197
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: DMatScalarDivExpr.h:180
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DMatScalarDivExpr.h:166
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: DMatScalarDivExpr.h:487
Base template for the DivTrait class.
Definition: DivTrait.h:141
#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:118
Header file for all intrinsic functionality.
bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:333
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DMatScalarDivExpr.h:190
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatScalarDivExpr.h:518
bool isAligned() const
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatScalarDivExpr.h:572
Header file for the IsRowMajorMatrix type trait.
bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:355
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatScalarDivExpr.h:455
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: DMatScalarDivExpr.h:498
friend const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DMatScalarDivExpr.h:389
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DMatScalarDivExpr.h:311
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
Header file for basic type definitions.
friend const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DMatScalarDivExpr.h:401
MT::ConstIterator IteratorType
ConstIterator type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:204
Header file for the MatScalarDivExpr base class.
LeftOperand leftOperand() const
Returns the left-hand side dense matrix operand.
Definition: DMatScalarDivExpr.h:528
MT::ReturnType RN
Return type of the dense matrix expression.
Definition: DMatScalarDivExpr.h:109
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
DifferenceType difference_type
Difference between two iterators.
Definition: DMatScalarDivExpr.h:201
#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
ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DMatScalarDivExpr.h:290
EnableIf< IsIntegral< T >, Set< T, sizeof(T)> >::Type::Type set(T value)
Sets all values in the vector to the given integral value.
Definition: Set.h:209
IntrinsicTrait< ElementType >::Type IntrinsicType
Resulting intrinsic element type.
Definition: DMatScalarDivExpr.h:168
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.