SMatScalarDivExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATSCALARDIVEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
76 #include <blaze/util/Assert.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/InvalidType.h>
84 #include <blaze/util/SelectType.h>
85 #include <blaze/util/Types.h>
90 
91 
92 namespace blaze {
93 
94 //=================================================================================================
95 //
96 // CLASS SMATSCALARDIVEXPR
97 //
98 //=================================================================================================
99 
100 //*************************************************************************************************
107 template< typename MT // Type of the left-hand side sparse matrix
108  , typename ST // Type of the right-hand side scalar value
109  , bool SO > // Storage order
110 class SMatScalarDivExpr : public SparseMatrix< SMatScalarDivExpr<MT,ST,SO>, SO >
111  , private MatScalarDivExpr
112  , private Computation
113 {
114  private:
115  //**Type definitions****************************************************************************
116  typedef typename MT::ResultType RT;
117  typedef typename MT::ReturnType RN;
118  typedef typename MT::CompositeType CT;
119  //**********************************************************************************************
120 
121  //**Return type evaluation**********************************************************************
123 
128  enum { returnExpr = !IsTemporary<RN>::value };
129 
132  //**********************************************************************************************
133 
134  //**Serial evaluation strategy******************************************************************
136 
142  enum { useAssign = RequiresEvaluation<MT>::value };
143 
145  template< typename MT2 >
147  struct UseAssign {
148  enum { value = useAssign };
149  };
151  //**********************************************************************************************
152 
153  //**Parallel evaluation strategy****************************************************************
155 
161  template< typename MT2 >
162  struct UseSMPAssign {
163  enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
164  };
166  //**********************************************************************************************
167 
168  public:
169  //**Type definitions****************************************************************************
175 
178 
181 
183  typedef typename SelectType< IsExpression<MT>::value, const MT, const MT& >::Type LeftOperand;
184 
186  typedef ST RightOperand;
187  //**********************************************************************************************
188 
189  //**ConstIterator class definition**************************************************************
193  {
194  public:
195  //**Type definitions*************************************************************************
198 
201 
202  typedef std::forward_iterator_tag IteratorCategory;
203  typedef Element ValueType;
204  typedef ValueType* PointerType;
205  typedef ValueType& ReferenceType;
207 
208  // STL iterator requirements
209  typedef IteratorCategory iterator_category;
210  typedef ValueType value_type;
211  typedef PointerType pointer;
212  typedef ReferenceType reference;
213  typedef DifferenceType difference_type;
214  //*******************************************************************************************
215 
216  //**Constructor******************************************************************************
219  inline ConstIterator( IteratorType matrix, RightOperand scalar )
220  : matrix_( matrix ) // Iterator over the elements of the left-hand side sparse matrix expression
221  , scalar_( scalar ) // Right-hand side scalar of the division expression
222  {}
223  //*******************************************************************************************
224 
225  //**Prefix increment operator****************************************************************
231  ++matrix_;
232  return *this;
233  }
234  //*******************************************************************************************
235 
236  //**Element access operator******************************************************************
241  inline const Element operator*() const {
242  return Element( matrix_->value() / scalar_, matrix_->index() );
243  }
244  //*******************************************************************************************
245 
246  //**Element access operator******************************************************************
251  inline const ConstIterator* operator->() const {
252  return this;
253  }
254  //*******************************************************************************************
255 
256  //**Value function***************************************************************************
261  inline ReturnType value() const {
262  return matrix_->value() / scalar_;
263  }
264  //*******************************************************************************************
265 
266  //**Index function***************************************************************************
271  inline size_t index() const {
272  return matrix_->index();
273  }
274  //*******************************************************************************************
275 
276  //**Equality operator************************************************************************
282  inline bool operator==( const ConstIterator& rhs ) const {
283  return matrix_ == rhs.matrix_;
284  }
285  //*******************************************************************************************
286 
287  //**Inequality operator**********************************************************************
293  inline bool operator!=( const ConstIterator& rhs ) const {
294  return matrix_ != rhs.matrix_;
295  }
296  //*******************************************************************************************
297 
298  //**Subtraction operator*********************************************************************
304  inline DifferenceType operator-( const ConstIterator& rhs ) const {
305  return matrix_ - rhs.matrix_;
306  }
307  //*******************************************************************************************
308 
309  private:
310  //**Member variables*************************************************************************
311  IteratorType matrix_;
312  RightOperand scalar_;
313  //*******************************************************************************************
314  };
315  //**********************************************************************************************
316 
317  //**Compilation flags***************************************************************************
319  enum { smpAssignable = 0 };
320  //**********************************************************************************************
321 
322  //**Constructor*********************************************************************************
328  explicit inline SMatScalarDivExpr( const MT& matrix, ST scalar )
329  : matrix_( matrix ) // Left-hand side sparse matrix of the division expression
330  , scalar_( scalar ) // Right-hand side scalar of the division expression
331  {}
332  //**********************************************************************************************
333 
334  //**Access operator*****************************************************************************
341  inline ReturnType operator()( size_t i, size_t j ) const {
342  BLAZE_INTERNAL_ASSERT( i < matrix_.rows() , "Invalid row access index" );
343  BLAZE_INTERNAL_ASSERT( j < matrix_.columns(), "Invalid column access index" );
344  return matrix_(i,j) / scalar_;
345  }
346  //**********************************************************************************************
347 
348  //**Begin function******************************************************************************
354  inline ConstIterator begin( size_t i ) const {
355  return ConstIterator( matrix_.begin(i), scalar_ );
356  }
357  //**********************************************************************************************
358 
359  //**End function********************************************************************************
365  inline ConstIterator end( size_t i ) const {
366  return ConstIterator( matrix_.end(i), scalar_ );
367  }
368  //**********************************************************************************************
369 
370  //**Rows function*******************************************************************************
375  inline size_t rows() const {
376  return matrix_.rows();
377  }
378  //**********************************************************************************************
379 
380  //**Columns function****************************************************************************
385  inline size_t columns() const {
386  return matrix_.columns();
387  }
388  //**********************************************************************************************
389 
390  //**NonZeros function***************************************************************************
395  inline size_t nonZeros() const {
396  return matrix_.nonZeros();
397  }
398  //**********************************************************************************************
399 
400  //**NonZeros function***************************************************************************
406  inline size_t nonZeros( size_t i ) const {
407  return matrix_.nonZeros(i);
408  }
409  //**********************************************************************************************
410 
411  //**Find function*******************************************************************************
418  inline ConstIterator find( size_t i, size_t j ) const {
420  return ConstIterator( matrix_.find( i, j ), scalar_ );
421  }
422  //**********************************************************************************************
423 
424  //**LowerBound function*************************************************************************
431  inline ConstIterator lowerBound( size_t i, size_t j ) const {
433  return ConstIterator( matrix_.lowerBound( i, j ), scalar_ );
434  }
435  //**********************************************************************************************
436 
437  //**UpperBound function*************************************************************************
444  inline ConstIterator upperBound( size_t i, size_t j ) const {
446  return ConstIterator( matrix_.upperBound( i, j ), scalar_ );
447  }
448  //**********************************************************************************************
449 
450  //**Left operand access*************************************************************************
455  inline LeftOperand leftOperand() const {
456  return matrix_;
457  }
458  //**********************************************************************************************
459 
460  //**Right operand access************************************************************************
465  inline RightOperand rightOperand() const {
466  return scalar_;
467  }
468  //**********************************************************************************************
469 
470  //**********************************************************************************************
476  template< typename T >
477  inline bool canAlias( const T* alias ) const {
478  return matrix_.canAlias( alias );
479  }
480  //**********************************************************************************************
481 
482  //**********************************************************************************************
488  template< typename T >
489  inline bool isAliased( const T* alias ) const {
490  return matrix_.isAliased( alias );
491  }
492  //**********************************************************************************************
493 
494  private:
495  //**Member variables****************************************************************************
496  LeftOperand matrix_;
497  RightOperand scalar_;
498  //**********************************************************************************************
499 
500  //**Assignment to dense matrices****************************************************************
514  template< typename MT2 // Type of the target dense matrix
515  , bool SO2 > // Storage order of the target dense matrix
516  friend inline typename EnableIf< UseAssign<MT2> >::Type
517  assign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
518  {
520 
521  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
522  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
523 
524  assign( ~lhs, rhs.matrix_ );
525  (~lhs) /= rhs.scalar_;
526  }
528  //**********************************************************************************************
529 
530  //**Assignment to sparse matrices***************************************************************
544  template< typename MT2 // Type of the target sparse matrix
545  , bool SO2 > // Storage order of the target sparse matrix
546  friend inline typename EnableIf< UseAssign<MT2> >::Type
548  {
550 
551  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
552  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
553 
554  assign( ~lhs, rhs.matrix_ );
555  (~lhs) /= rhs.scalar_;
556  }
558  //**********************************************************************************************
559 
560  //**Addition assignment to dense matrices*******************************************************
574  template< typename MT2 // Type of the target dense matrix
575  , bool SO2 > // Storage order of the target dense matrix
576  friend inline typename EnableIf< UseAssign<MT2> >::Type
577  addAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
578  {
580 
583 
584  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
585  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
586 
587  const ResultType tmp( serial( rhs ) );
588  addAssign( ~lhs, tmp );
589  }
591  //**********************************************************************************************
592 
593  //**Addition assignment to sparse matrices******************************************************
594  // No special implementation for the addition assignment to sparse matrices.
595  //**********************************************************************************************
596 
597  //**Subtraction assignment to dense matrices****************************************************
611  template< typename MT2 // Type of the target dense matrix
612  , bool SO2 > // Storage order of the target dense matrix
613  friend inline typename EnableIf< UseAssign<MT2> >::Type
614  subAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
615  {
617 
620 
621  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
622  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
623 
624  const ResultType tmp( serial( rhs ) );
625  subAssign( ~lhs, tmp );
626  }
628  //**********************************************************************************************
629 
630  //**Subtraction assignment to sparse matrices***************************************************
631  // No special implementation for the subtraction assignment to sparse matrices.
632  //**********************************************************************************************
633 
634  //**Multiplication assignment to dense matrices*************************************************
635  // No special implementation for the multiplication assignment to dense matrices.
636  //**********************************************************************************************
637 
638  //**Multiplication assignment to sparse matrices************************************************
639  // No special implementation for the multiplication assignment to sparse matrices.
640  //**********************************************************************************************
641 
642  //**SMP assignment to dense matrices************************************************************
643  // No special implementation for the SMP assignment to dense matrices.
644  //**********************************************************************************************
645 
646  //**SMP assignment to sparse matrices***********************************************************
647  // No special implementation for the SMP assignment to sparse matrices.
648  //**********************************************************************************************
649 
650  //**SMP addition assignment to dense matrices***************************************************
664  template< typename MT2 // Type of the target dense matrix
665  , bool SO2 > // Storage order of the target dense matrix
666  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
667  smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
668  {
670 
673 
674  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
675  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
676 
677  const ResultType tmp( rhs );
678  smpAddAssign( ~lhs, tmp );
679  }
681  //**********************************************************************************************
682 
683  //**SMP addition assignment to sparse matrices**************************************************
684  // No special implementation for the SMP addition assignment to sparse matrices.
685  //**********************************************************************************************
686 
687  //**SMP subtraction assignment to dense matrices************************************************
701  template< typename MT2 // Type of the target dense matrix
702  , bool SO2 > // Storage order of the target dense matrix
703  friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
704  smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const SMatScalarDivExpr& rhs )
705  {
707 
710 
711  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
712  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
713 
714  const ResultType tmp( rhs );
715  smpSubAssign( ~lhs, tmp );
716  }
718  //**********************************************************************************************
719 
720  //**SMP subtraction assignment to sparse matrices***********************************************
721  // No special implementation for the SMP subtraction assignment to sparse matrices.
722  //**********************************************************************************************
723 
724  //**Multiplication assignment to dense matrices*************************************************
725  // No special implementation for the SMP multiplication assignment to dense matrices.
726  //**********************************************************************************************
727 
728  //**SMP multiplication assignment to sparse matrices********************************************
729  // No special implementation for the SMP multiplication assignment to sparse matrices.
730  //**********************************************************************************************
731 
732  //**Compile time checks*************************************************************************
739  BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ST, RightOperand );
741  //**********************************************************************************************
742 };
743 //*************************************************************************************************
744 
745 
746 
747 
748 //=================================================================================================
749 //
750 // GLOBAL BINARY ARITHMETIC OPERATORS
751 //
752 //=================================================================================================
753 
754 //*************************************************************************************************
776 template< typename T1 // Type of the left-hand side sparse matrix
777  , bool SO // Storage order of the left-hand side sparse matrix
778  , typename T2 > // Type of the right-hand side scalar
779 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
780  operator/( const SparseMatrix<T1,SO>& mat, T2 scalar )
781 {
783 
784  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
785 
786  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
787  typedef typename ReturnType::RightOperand ScalarType;
788 
790  return ReturnType( ~mat, ScalarType(1)/ScalarType(scalar) );
791  }
792  else {
793  return ReturnType( ~mat, scalar );
794  }
795 }
796 //*************************************************************************************************
797 
798 
799 
800 
801 //=================================================================================================
802 //
803 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
804 //
805 //=================================================================================================
806 
807 //*************************************************************************************************
820 template< typename MT // Type of the sparse matrix of the left-hand side expression
821  , typename ST1 // Type of the scalar of the left-hand side expression
822  , bool SO // Storage order of the sparse matrix
823  , typename ST2 > // Type of the right-hand side scalar
824 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST2,ST1>::Type >
825  , typename MultExprTrait< SMatScalarDivExpr<MT,ST1,SO>, ST2 >::Type >::Type
826  operator*( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
827 {
829 
830  return mat.leftOperand() * ( scalar / mat.rightOperand() );
831 }
833 //*************************************************************************************************
834 
835 
836 //*************************************************************************************************
849 template< typename ST1 // Type of the left-hand side scalar
850  , typename MT // Type of the sparse matrix of the right-hand side expression
851  , typename ST2 // Type of the scalar of the right-hand side expression
852  , bool SO > // Storage order of the sparse matrix
853 inline const typename EnableIf< IsFloatingPoint< typename DivTrait<ST1,ST2>::Type >
854  , typename MultExprTrait< ST1, SMatScalarDivExpr<MT,ST2,SO> >::Type >::Type
855  operator*( ST1 scalar, const SMatScalarDivExpr<MT,ST2,SO>& mat )
856 {
858 
859  return mat.leftOperand() * ( scalar / mat.rightOperand() );
860 }
862 //*************************************************************************************************
863 
864 
865 //*************************************************************************************************
878 template< typename MT // Type of the sparse matrix of the left-hand side expression
879  , typename ST1 // Type of the scalar of the left-hand side expression
880  , bool SO // Storage order of the sparse matrix
881  , typename ST2 > // Type of the right-hand side scalar
882 inline const typename EnableIf< IsNumeric<ST2>
883  , typename DivExprTrait<MT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
884  operator/( const SMatScalarDivExpr<MT,ST1,SO>& mat, ST2 scalar )
885 {
887 
888  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
889 
890  typedef typename MultTrait<ST1,ST2>::Type MultType;
891  typedef typename DivExprTrait<MT,MultType>::Type ReturnType;
892  typedef typename ReturnType::RightOperand ScalarType;
893 
894  if( IsMultExpr<ReturnType>::value ) {
895  return ReturnType( mat.leftOperand(), ScalarType(1)/( mat.rightOperand() * scalar ) );
896  }
897  else {
898  return ReturnType( mat.leftOperand(), mat.rightOperand() * scalar );
899  }
900 }
902 //*************************************************************************************************
903 
904 
905 
906 
907 //=================================================================================================
908 //
909 // ROWS SPECIALIZATIONS
910 //
911 //=================================================================================================
912 
913 //*************************************************************************************************
915 template< typename MT, typename ST, bool SO >
916 struct Rows< SMatScalarDivExpr<MT,ST,SO> > : public Columns<MT>
917 {};
919 //*************************************************************************************************
920 
921 
922 
923 
924 //=================================================================================================
925 //
926 // COLUMNS SPECIALIZATIONS
927 //
928 //=================================================================================================
929 
930 //*************************************************************************************************
932 template< typename MT, typename ST, bool SO >
933 struct Columns< SMatScalarDivExpr<MT,ST,SO> > : public Rows<MT>
934 {};
936 //*************************************************************************************************
937 
938 
939 
940 
941 //=================================================================================================
942 //
943 // ISSYMMETRIC SPECIALIZATIONS
944 //
945 //=================================================================================================
946 
947 //*************************************************************************************************
949 template< typename MT, typename ST, bool SO >
950 struct IsSymmetric< SMatScalarDivExpr<MT,ST,SO> > : public IsTrue< IsSymmetric<MT>::value >
951 {};
953 //*************************************************************************************************
954 
955 
956 
957 
958 //=================================================================================================
959 //
960 // ISLOWER SPECIALIZATIONS
961 //
962 //=================================================================================================
963 
964 //*************************************************************************************************
966 template< typename MT, typename ST, bool SO >
967 struct IsLower< SMatScalarDivExpr<MT,ST,SO> > : public IsTrue< IsLower<MT>::value >
968 {};
970 //*************************************************************************************************
971 
972 
973 
974 
975 //=================================================================================================
976 //
977 // ISSTRICTLYLOWER SPECIALIZATIONS
978 //
979 //=================================================================================================
980 
981 //*************************************************************************************************
983 template< typename MT, typename ST, bool SO >
984 struct IsStrictlyLower< SMatScalarDivExpr<MT,ST,SO> > : public IsTrue< IsStrictlyLower<MT>::value >
985 {};
987 //*************************************************************************************************
988 
989 
990 
991 
992 //=================================================================================================
993 //
994 // ISUPPER SPECIALIZATIONS
995 //
996 //=================================================================================================
997 
998 //*************************************************************************************************
1000 template< typename MT, typename ST, bool SO >
1001 struct IsUpper< SMatScalarDivExpr<MT,ST,SO> > : public IsTrue< IsUpper<MT>::value >
1002 {};
1004 //*************************************************************************************************
1005 
1006 
1007 
1008 
1009 //=================================================================================================
1010 //
1011 // ISSTRICTLYUPPER SPECIALIZATIONS
1012 //
1013 //=================================================================================================
1014 
1015 //*************************************************************************************************
1017 template< typename MT, typename ST, bool SO >
1018 struct IsStrictlyUpper< SMatScalarDivExpr<MT,ST,SO> > : public IsTrue< IsStrictlyUpper<MT>::value >
1019 {};
1021 //*************************************************************************************************
1022 
1023 
1024 
1025 
1026 //=================================================================================================
1027 //
1028 // SMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1029 //
1030 //=================================================================================================
1031 
1032 //*************************************************************************************************
1034 template< typename MT, typename ST1, typename ST2 >
1035 struct SMatScalarMultExprTrait< SMatScalarDivExpr<MT,ST1,false>, ST2 >
1036 {
1037  private:
1038  //**********************************************************************************************
1039  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1040  //**********************************************************************************************
1041 
1042  //**********************************************************************************************
1043  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1044  typedef SMatScalarMultExpr< SMatScalarDivExpr<MT,ST1,false>, ST2, false > T2;
1045  //**********************************************************************************************
1046 
1047  public:
1048  //**********************************************************************************************
1049  typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value &&
1050  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1051  , typename SelectType<condition,T1,T2>::Type
1052  , INVALID_TYPE >::Type Type;
1053  //**********************************************************************************************
1054 };
1056 //*************************************************************************************************
1057 
1058 
1059 
1060 
1061 //=================================================================================================
1062 //
1063 // TSMATSCALARMULTEXPRTRAIT SPECIALIZATIONS
1064 //
1065 //=================================================================================================
1066 
1067 //*************************************************************************************************
1069 template< typename MT, typename ST1, typename ST2 >
1070 struct TSMatScalarMultExprTrait< SMatScalarDivExpr<MT,ST1,true>, ST2 >
1071 {
1072  private:
1073  //**********************************************************************************************
1074  enum { condition = IsFloatingPoint<typename DivTrait<ST1,ST2>::Type>::value };
1075  //**********************************************************************************************
1076 
1077  //**********************************************************************************************
1078  typedef typename SMatScalarMultExprTrait<MT,typename DivTrait<ST1,ST2>::Type>::Type T1;
1079  typedef SMatScalarMultExpr< SMatScalarDivExpr<MT,ST1,true>, ST2, true > T2;
1080  //**********************************************************************************************
1081 
1082  public:
1083  //**********************************************************************************************
1084  typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value &&
1085  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1086  , typename SelectType<condition,T1,T2>::Type
1087  , INVALID_TYPE >::Type Type;
1088  //**********************************************************************************************
1089 };
1091 //*************************************************************************************************
1092 
1093 
1094 
1095 
1096 //=================================================================================================
1097 //
1098 // SUBMATRIXEXPRTRAIT SPECIALIZATIONS
1099 //
1100 //=================================================================================================
1101 
1102 //*************************************************************************************************
1104 template< typename MT, typename ST, bool SO, bool AF >
1105 struct SubmatrixExprTrait< SMatScalarDivExpr<MT,ST,SO>, AF >
1106 {
1107  public:
1108  //**********************************************************************************************
1109  typedef typename DivExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type, ST >::Type Type;
1110  //**********************************************************************************************
1111 };
1113 //*************************************************************************************************
1114 
1115 
1116 
1117 
1118 //=================================================================================================
1119 //
1120 // ROWEXPRTRAIT SPECIALIZATIONS
1121 //
1122 //=================================================================================================
1123 
1124 //*************************************************************************************************
1126 template< typename MT, typename ST, bool SO >
1127 struct RowExprTrait< SMatScalarDivExpr<MT,ST,SO> >
1128 {
1129  public:
1130  //**********************************************************************************************
1131  typedef typename DivExprTrait< typename RowExprTrait<const MT>::Type, ST >::Type Type;
1132  //**********************************************************************************************
1133 };
1135 //*************************************************************************************************
1136 
1137 
1138 
1139 
1140 //=================================================================================================
1141 //
1142 // COLUMNEXPRTRAIT SPECIALIZATIONS
1143 //
1144 //=================================================================================================
1145 
1146 //*************************************************************************************************
1148 template< typename MT, typename ST, bool SO >
1149 struct ColumnExprTrait< SMatScalarDivExpr<MT,ST,SO> >
1150 {
1151  public:
1152  //**********************************************************************************************
1153  typedef typename DivExprTrait< typename ColumnExprTrait<const MT>::Type, ST >::Type Type;
1154  //**********************************************************************************************
1155 };
1157 //*************************************************************************************************
1158 
1159 } // namespace blaze
1160 
1161 #endif
IteratorType matrix_
Iterator over the elements of the left-hand side sparse matrix expression.
Definition: SMatScalarDivExpr.h:311
Pointer difference type of the Blaze library.
Data type constraint.
ConstIterator(IteratorType matrix, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SMatScalarDivExpr.h:219
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
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for the Rows type trait.
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:8247
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:939
PointerType pointer
Pointer return type.
Definition: SMatScalarDivExpr.h:211
Header file for basic type definitions.
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:117
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
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatScalarDivExpr.h:173
Header file for the IsSparseMatrix type trait.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatScalarDivExpr.h:172
#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:209
Header file for the ColumnExprTrait class template.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatScalarDivExpr.h:375
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatScalarDivExpr.h:477
Header file for the IsColumnMajorMatrix type trait.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatScalarDivExpr.h:489
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatScalarDivExpr.h:304
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:261
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:118
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SMatScalarDivExpr.h:186
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatScalarDivExpr.h:444
Header file for the Computation base class.
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatScalarDivExpr.h:431
Header file for the RequiresEvaluation type trait.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:293
SMatScalarDivExpr(const MT &matrix, ST scalar)
Constructor for the SMatScalarDivExpr class.
Definition: SMatScalarDivExpr.h:328
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
ValueType * PointerType
Pointer return type.
Definition: SMatScalarDivExpr.h:204
Constraint on the data type.
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:251
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatScalarDivExpr.h:395
Header file for the SparseMatrix base class.
Header file for the DivExprTrait class template.
RemoveReference< LeftOperand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:200
Evaluation of the resulting expression type of a division.Via this type trait it is possible to evalu...
Definition: DivExprTrait.h:88
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
ReferenceType reference
Reference return type.
Definition: SMatScalarDivExpr.h:212
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:263
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatScalarDivExpr.h:365
Header file for the ValueIndexPair class.
IteratorCategory iterator_category
The iterator category.
Definition: SMatScalarDivExpr.h:209
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
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
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatScalarDivExpr.h:261
Element ValueType
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:203
Header file for the IsFloatingPoint type trait.
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatScalarDivExpr.h:354
Iterator over the elements of the sparse matrix/scalar division expression.
Definition: SMatScalarDivExpr.h:192
MultTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: SMatScalarDivExpr.h:171
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
BLAZE_ALWAYS_INLINE 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:635
Header file for the Columns type trait.
SMatScalarDivExpr< MT, ST, SO > This
Type of this SMatScalarDivExpr instance.
Definition: SMatScalarDivExpr.h:170
#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
Header file for the IsLower type trait.
LeftOperand matrix_
Left-hand side sparse matrix of the division expression.
Definition: SMatScalarDivExpr.h:496
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatScalarDivExpr.h:282
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatScalarDivExpr.h:206
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:312
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatScalarDivExpr.h:177
#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
LeftOperand leftOperand() const
Returns the left-hand side sparse matrix operand.
Definition: SMatScalarDivExpr.h:455
Constraints on the storage order of matrix types.
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatScalarDivExpr.h:241
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type LeftOperand
Composite data type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:183
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatScalarDivExpr.h:174
Constraint on the data type.
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 EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
Header file for the BaseElementType type trait.
Header file for the IsNumeric type trait.
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:116
EnableIf< IsDenseMatrix< MT1 > >::Type 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:160
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
ValueType value_type
Type of the underlying pointers.
Definition: SMatScalarDivExpr.h:210
Header file for run time assertion macros.
Utility type for generic codes.
Base template for the MultTrait class.
Definition: MultTrait.h:150
BLAZE_ALWAYS_INLINE 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:742
Header file for the division trait.
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatScalarDivExpr.h:230
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:93
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
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatScalarDivExpr.h:418
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: SMatScalarDivExpr.h:465
#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:118
Header file for the RemoveReference type trait.
#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
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatScalarDivExpr.h:197
ValueType & ReferenceType
Reference return type.
Definition: SMatScalarDivExpr.h:205
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Header file for the IsRowMajorMatrix type trait.
Header file for the IsComputation type trait class.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatScalarDivExpr.h:385
SelectType< useAssign, const ResultType, const SMatScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatScalarDivExpr.h:180
EnableIf< IsDenseMatrix< MT1 > >::Type 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:129
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
Header file for the IsTrue value trait.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatScalarDivExpr.h:202
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SMatScalarDivExpr.h:497
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatScalarDivExpr.h:131
Header file for the IsUpper type trait.
Header file for the MatScalarDivExpr base class.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatScalarDivExpr.h:406
DifferenceType difference_type
Difference between two iterators.
Definition: SMatScalarDivExpr.h:213
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatScalarDivExpr.h:341
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE 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:849
size_t index() const
Access to the current index of the sparse element.
Definition: SMatScalarDivExpr.h:271