SVecScalarDivExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSCALARDIVEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECSCALARDIVEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <blaze/math/Aliases.h>
48 #include <blaze/math/Exception.h>
70 #include <blaze/util/Assert.h>
75 #include <blaze/util/EnableIf.h>
76 #include <blaze/util/InvalidType.h>
78 #include <blaze/util/mpl/And.h>
79 #include <blaze/util/mpl/If.h>
80 #include <blaze/util/mpl/Or.h>
81 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS SVECSCALARDIVEXPR
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
101 template< typename VT // Type of the left-hand side sparse vector
102  , typename ST // Type of the right-hand side scalar value
103  , bool TF > // Transpose flag
104 class SVecScalarDivExpr : public SparseVector< SVecScalarDivExpr<VT,ST,TF>, TF >
105  , private VecScalarDivExpr
106  , private Computation
107 {
108  private:
109  //**Type definitions****************************************************************************
110  typedef ResultType_<VT> RT;
111  typedef ReturnType_<VT> RN;
113  //**********************************************************************************************
114 
115  //**Return type evaluation**********************************************************************
117 
122  enum : bool { returnExpr = !IsTemporary<RN>::value };
123 
126  //**********************************************************************************************
127 
128  //**Serial evaluation strategy******************************************************************
130 
136  enum : bool { useAssign = RequiresEvaluation<VT>::value };
137 
139  template< typename VT2 >
141  struct UseAssign {
142  enum : bool { value = useAssign };
143  };
145  //**********************************************************************************************
146 
147  //**Parallel evaluation strategy****************************************************************
149 
155  template< typename VT2 >
156  struct UseSMPAssign {
157  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
158  };
160  //**********************************************************************************************
161 
162  public:
163  //**Type definitions****************************************************************************
168 
171 
174 
176  typedef If_< IsExpression<VT>, const VT, const VT& > LeftOperand;
177 
179  typedef ST RightOperand;
180  //**********************************************************************************************
181 
182  //**Compilation flags***************************************************************************
184  enum : bool { smpAssignable = false };
185  //**********************************************************************************************
186 
187  //**ConstIterator class definition**************************************************************
191  {
192  public:
193  //**Type definitions*************************************************************************
196 
199 
200  typedef std::forward_iterator_tag IteratorCategory;
201  typedef Element ValueType;
202  typedef ValueType* PointerType;
203  typedef ValueType& ReferenceType;
205 
206  // STL iterator requirements
207  typedef IteratorCategory iterator_category;
208  typedef ValueType value_type;
209  typedef PointerType pointer;
210  typedef ReferenceType reference;
211  typedef DifferenceType difference_type;
212  //*******************************************************************************************
213 
214  //**Constructor******************************************************************************
217  inline ConstIterator( IteratorType vector, RightOperand scalar )
218  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
219  , scalar_( scalar ) // Right hand side scalar of the multiplication expression
220  {}
221  //*******************************************************************************************
222 
223  //**Prefix increment operator****************************************************************
229  ++vector_;
230  return *this;
231  }
232  //*******************************************************************************************
233 
234  //**Element access operator******************************************************************
239  inline const Element operator*() const {
240  return Element( vector_->value() / scalar_, vector_->index() );
241  }
242  //*******************************************************************************************
243 
244  //**Element access operator******************************************************************
249  inline const ConstIterator* operator->() const {
250  return this;
251  }
252  //*******************************************************************************************
253 
254  //**Value function***************************************************************************
259  inline ReturnType value() const {
260  return vector_->value() / scalar_;
261  }
262  //*******************************************************************************************
263 
264  //**Index function***************************************************************************
269  inline size_t index() const {
270  return vector_->index();
271  }
272  //*******************************************************************************************
273 
274  //**Equality operator************************************************************************
280  inline bool operator==( const ConstIterator& rhs ) const {
281  return vector_ == rhs.vector_;
282  }
283  //*******************************************************************************************
284 
285  //**Inequality operator**********************************************************************
291  inline bool operator!=( const ConstIterator& rhs ) const {
292  return vector_ != rhs.vector_;
293  }
294  //*******************************************************************************************
295 
296  //**Subtraction operator*********************************************************************
302  inline DifferenceType operator-( const ConstIterator& rhs ) const {
303  return vector_ - rhs.vector_;
304  }
305  //*******************************************************************************************
306 
307  private:
308  //**Member variables*************************************************************************
309  IteratorType vector_;
310  RightOperand scalar_;
311  //*******************************************************************************************
312  };
313  //**********************************************************************************************
314 
315  //**Constructor*********************************************************************************
321  explicit inline SVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
322  : vector_( vector ) // Left-hand side sparse vector of the division expression
323  , scalar_( scalar ) // Right-hand side scalar of the division expression
324  {}
325  //**********************************************************************************************
326 
327  //**Subscript operator**************************************************************************
333  inline ReturnType operator[]( size_t index ) const {
334  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
335  return vector_[index] / scalar_;
336  }
337  //**********************************************************************************************
338 
339  //**At function*********************************************************************************
346  inline ReturnType at( size_t index ) const {
347  if( index >= vector_.size() ) {
348  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
349  }
350  return (*this)[index];
351  }
352  //**********************************************************************************************
353 
354  //**Begin function******************************************************************************
359  inline ConstIterator begin() const {
360  return ConstIterator( vector_.begin(), scalar_ );
361  }
362  //**********************************************************************************************
363 
364  //**End function********************************************************************************
369  inline ConstIterator end() const {
370  return ConstIterator( vector_.end(), scalar_ );
371  }
372  //**********************************************************************************************
373 
374  //**Size function*******************************************************************************
379  inline size_t size() const noexcept {
380  return vector_.size();
381  }
382  //**********************************************************************************************
383 
384  //**NonZeros function***************************************************************************
389  inline size_t nonZeros() const {
390  return vector_.nonZeros();
391  }
392  //**********************************************************************************************
393 
394  //**Find function*******************************************************************************
400  inline ConstIterator find( size_t index ) const {
402  return ConstIterator( vector_.find( index ), scalar_ );
403  }
404  //**********************************************************************************************
405 
406  //**LowerBound function*************************************************************************
412  inline ConstIterator lowerBound( size_t index ) const {
414  return ConstIterator( vector_.lowerBound( index ), scalar_ );
415  }
416  //**********************************************************************************************
417 
418  //**UpperBound function*************************************************************************
424  inline ConstIterator upperBound( size_t index ) const {
426  return ConstIterator( vector_.upperBound( index ), scalar_ );
427  }
428  //**********************************************************************************************
429 
430  //**Left operand access*************************************************************************
435  inline LeftOperand leftOperand() const noexcept {
436  return vector_;
437  }
438  //**********************************************************************************************
439 
440  //**Right operand access************************************************************************
445  inline RightOperand rightOperand() const noexcept {
446  return scalar_;
447  }
448  //**********************************************************************************************
449 
450  //**********************************************************************************************
456  template< typename T >
457  inline bool canAlias( const T* alias ) const noexcept {
458  return vector_.canAlias( alias );
459  }
460  //**********************************************************************************************
461 
462  //**********************************************************************************************
468  template< typename T >
469  inline bool isAliased( const T* alias ) const noexcept {
470  return vector_.isAliased( alias );
471  }
472  //**********************************************************************************************
473 
474  private:
475  //**Member variables****************************************************************************
476  LeftOperand vector_;
477  RightOperand scalar_;
478  //**********************************************************************************************
479 
480  //**Assignment to dense vectors*****************************************************************
494  template< typename VT2 > // Type of the target dense vector
495  friend inline EnableIf_< UseAssign<VT2> >
496  assign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
497  {
499 
500  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
501 
502  assign( ~lhs, rhs.vector_ );
503  (~lhs) /= rhs.scalar_;
504  }
506  //**********************************************************************************************
507 
508  //**Assignment to sparse vectors****************************************************************
522  template< typename VT2 > // Type of the target sparse vector
523  friend inline EnableIf_< UseAssign<VT2> >
524  assign( SparseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
525  {
527 
528  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
529 
530  assign( ~lhs, rhs.vector_ );
531  (~lhs) /= rhs.scalar_;
532  }
534  //**********************************************************************************************
535 
536  //**Addition assignment to dense vectors********************************************************
550  template< typename VT2 > // Type of the target dense vector
551  friend inline EnableIf_< UseAssign<VT2> >
552  addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
553  {
555 
558  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
559 
560  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
561 
562  const ResultType tmp( serial( rhs ) );
563  addAssign( ~lhs, tmp );
564  }
566  //**********************************************************************************************
567 
568  //**Addition assignment to sparse vectors*******************************************************
569  // No special implementation for the addition assignment to sparse vectors.
570  //**********************************************************************************************
571 
572  //**Subtraction assignment to dense vectors*****************************************************
586  template< typename VT2 > // Type of the target dense vector
587  friend inline EnableIf_< UseAssign<VT2> >
588  subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
589  {
591 
594  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
595 
596  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
597 
598  const ResultType tmp( serial( rhs ) );
599  subAssign( ~lhs, tmp );
600  }
602  //**********************************************************************************************
603 
604  //**Subtraction assignment to sparse vectors****************************************************
605  // No special implementation for the subtraction assignment to sparse vectors.
606  //**********************************************************************************************
607 
608  //**Multiplication assignment to dense vectors**************************************************
622  template< typename VT2 > // Type of the target dense vector
623  friend inline EnableIf_< UseAssign<VT2> >
624  multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
625  {
627 
630  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
631 
632  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
633 
634  const ResultType tmp( serial( rhs ) );
635  multAssign( ~lhs, tmp );
636  }
638  //**********************************************************************************************
639 
640  //**Multiplication assignment to sparse vectors*************************************************
641  // No special implementation for the multiplication assignment to sparse vectors.
642  //**********************************************************************************************
643 
644  //**SMP assignment to dense vectors*************************************************************
645  // No special implementation for the SMP assignment to dense vectors.
646  //**********************************************************************************************
647 
648  //**SMP assignment to sparse vectors************************************************************
649  // No special implementation for the SMP assignment to sparse vectors.
650  //**********************************************************************************************
651 
652  //**SMP addition assignment to dense vectors****************************************************
666  template< typename VT2 > // Type of the target dense vector
667  friend inline EnableIf_< UseSMPAssign<VT2> >
668  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
669  {
671 
674  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
675 
676  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
677 
678  const ResultType tmp( rhs );
679  smpAddAssign( ~lhs, tmp );
680  }
682  //**********************************************************************************************
683 
684  //**SMP addition assignment to sparse vectors***************************************************
685  // No special implementation for the SMP addition assignment to sparse vectors.
686  //**********************************************************************************************
687 
688  //**SMP subtraction assignment to dense vectors*************************************************
702  template< typename VT2 > // Type of the target dense vector
703  friend inline EnableIf_< UseSMPAssign<VT2> >
704  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
705  {
707 
710  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
711 
712  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
713 
714  const ResultType tmp( rhs );
715  smpSubAssign( ~lhs, tmp );
716  }
718  //**********************************************************************************************
719 
720  //**SMP subtraction assignment to sparse vectors************************************************
721  // No special implementation for the SMP subtraction assignment to sparse vectors.
722  //**********************************************************************************************
723 
724  //**SMP multiplication assignment to dense vectors**********************************************
738  template< typename VT2 > // Type of the target dense vector
739  friend inline EnableIf_< UseSMPAssign<VT2> >
740  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
741  {
743 
746  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
747 
748  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
749 
750  const ResultType tmp( rhs );
751  smpMultAssign( ~lhs, tmp );
752  }
754  //**********************************************************************************************
755 
756  //**SMP multiplication assignment to sparse vectors*********************************************
757  // No special implementation for the SMP multiplication assignment to sparse vectors.
758  //**********************************************************************************************
759 
760  //**Compile time checks*************************************************************************
767  BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ST, RightOperand );
769  //**********************************************************************************************
770 };
771 //*************************************************************************************************
772 
773 
774 
775 
776 //=================================================================================================
777 //
778 // GLOBAL BINARY ARITHMETIC OPERATORS
779 //
780 //=================================================================================================
781 
782 //*************************************************************************************************
805 template< typename T1 // Type of the left-hand side sparse vector
806  , typename T2 // Type of the right-hand side scalar
807  , bool TF > // Transpose flag
808 inline const EnableIf_< IsNumeric<T2>, DivExprTrait_<T1,T2> >
809  operator/( const SparseVector<T1,TF>& vec, T2 scalar )
810 {
812 
813  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
814 
816  typedef RightOperand_<ReturnType> ScalarType;
817 
819  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
820  }
821  else {
822  return ReturnType( ~vec, scalar );
823  }
824 }
825 //*************************************************************************************************
826 
827 
828 
829 
830 //=================================================================================================
831 //
832 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
833 //
834 //=================================================================================================
835 
836 //*************************************************************************************************
849 template< typename VT // Type of the sparse vector of the left-hand side expression
850  , typename ST1 // Type of the scalar of the left-hand side expression
851  , bool TF // Transpose flag of the sparse vector
852  , typename ST2 > // Type of the right-hand side scalar
853 inline const EnableIf_< And< IsNumeric<ST2>, Or< IsInvertible<ST1>, IsInvertible<ST2> > >
854  , MultExprTrait_< SVecScalarDivExpr<VT,ST1,TF>, ST2 > >
855  operator*( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
856 {
858 
859  return vec.leftOperand() * ( scalar / vec.rightOperand() );
860 }
862 //*************************************************************************************************
863 
864 
865 //*************************************************************************************************
878 template< typename ST1 // Type of the left-hand side scalar
879  , typename VT // Type of the sparse vector of the right-hand side expression
880  , typename ST2 // Type of the scalar of the right-hand side expression
881  , bool TF > // Transpose flag of the sparse vector
882 inline const EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > >
883  , MultExprTrait_< ST1, SVecScalarDivExpr<VT,ST2,TF> > >
884  operator*( ST1 scalar, const SVecScalarDivExpr<VT,ST2,TF>& vec )
885 {
887 
888  return vec.leftOperand() * ( scalar / vec.rightOperand() );
889 }
891 //*************************************************************************************************
892 
893 
894 //*************************************************************************************************
907 template< typename VT // Type of the sparse vector of the left-hand side expression
908  , typename ST1 // Type of the scalar of the left-hand side expression
909  , bool TF // Transpose flag of the sparse vector
910  , typename ST2 > // Type of the right-hand side scalar
911 inline const EnableIf_< IsNumeric<ST2>
912  , DivExprTrait_< VT, MultTrait_<ST1,ST2> > >
913  operator/( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
914 {
916 
917  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
918 
919  typedef MultTrait_<ST1,ST2> MultType;
920  typedef DivExprTrait_<VT,MultType> ReturnType;
921  typedef RightOperand_<ReturnType> ScalarType;
922 
923  if( IsMultExpr<ReturnType>::value ) {
924  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
925  }
926  else {
927  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
928  }
929 }
931 //*************************************************************************************************
932 
933 
934 
935 
936 //=================================================================================================
937 //
938 // SIZE SPECIALIZATIONS
939 //
940 //=================================================================================================
941 
942 //*************************************************************************************************
944 template< typename VT, typename ST, bool TF >
945 struct Size< SVecScalarDivExpr<VT,ST,TF> > : public Size<VT>
946 {};
948 //*************************************************************************************************
949 
950 
951 
952 
953 //=================================================================================================
954 //
955 // SVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
956 //
957 //=================================================================================================
958 
959 //*************************************************************************************************
961 template< typename VT, typename ST1, typename ST2 >
962 struct SVecScalarMultExprTrait< SVecScalarDivExpr<VT,ST1,false>, ST2 >
963 {
964  private:
965  //**********************************************************************************************
966  using ScalarType = DivTrait_<ST2,ST1>;
967  //**********************************************************************************************
968 
969  public:
970  //**********************************************************************************************
971  using Type = If_< And< IsSparseVector<VT>, IsColumnVector<VT>
972  , IsNumeric<ST1>, IsNumeric<ST2> >
973  , If_< IsInvertible<ScalarType>
974  , SVecScalarMultExprTrait_<VT,ScalarType>
975  , SVecScalarMultExpr< SVecScalarDivExpr<VT,ST1,false>, ST2, false > >
976  , INVALID_TYPE >;
977  //**********************************************************************************************
978 };
980 //*************************************************************************************************
981 
982 
983 
984 
985 //=================================================================================================
986 //
987 // TSVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
988 //
989 //=================================================================================================
990 
991 //*************************************************************************************************
993 template< typename VT, typename ST1, typename ST2 >
994 struct TSVecScalarMultExprTrait< SVecScalarDivExpr<VT,ST1,true>, ST2 >
995 {
996  private:
997  //**********************************************************************************************
998  using ScalarType = DivTrait_<ST2,ST1>;
999  //**********************************************************************************************
1000 
1001  public:
1002  //**********************************************************************************************
1003  using Type = If_< And< IsSparseVector<VT>, IsRowVector<VT>
1004  , IsNumeric<ST1>, IsNumeric<ST2> >
1005  , If_< IsInvertible<ScalarType>
1006  , SVecScalarMultExprTrait_<VT,ScalarType>
1007  , SVecScalarMultExpr< SVecScalarDivExpr<VT,ST1,true>, ST2, true > >
1008  , INVALID_TYPE >;
1009  //**********************************************************************************************
1010 };
1012 //*************************************************************************************************
1013 
1014 
1015 
1016 
1017 //=================================================================================================
1018 //
1019 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1020 //
1021 //=================================================================================================
1022 
1023 //*************************************************************************************************
1025 template< typename VT, typename ST, bool TF, bool AF >
1026 struct SubvectorExprTrait< SVecScalarDivExpr<VT,ST,TF>, AF >
1027 {
1028  public:
1029  //**********************************************************************************************
1030  using Type = DivExprTrait_< SubvectorExprTrait_<const VT,AF>, ST >;
1031  //**********************************************************************************************
1032 };
1034 //*************************************************************************************************
1035 
1036 } // namespace blaze
1037 
1038 #endif
CompositeType_< VT > CT
Composite type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:112
Pointer difference type of the Blaze library.
Header file for auxiliary alias declarations.
Data type constraint.
Constraint on the data type.
ConstIterator(IteratorType vector, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SVecScalarDivExpr.h:217
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:280
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:7800
Header file for basic type definitions.
Header file for the SparseVector base class.
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 constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:73
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarDivExpr.h:469
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:198
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecScalarDivExpr.h:424
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the serial shim.
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecScalarDivExpr.h:204
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:359
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:195
Header file for the IsRowVector type trait.
Header file for the VecScalarDivExpr base class.
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
Header file for the And class template.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
DifferenceType difference_type
Difference between two iterators.
Definition: SVecScalarDivExpr.h:211
ValueType * PointerType
Pointer return type.
Definition: SVecScalarDivExpr.h:202
Header file for the RequiresEvaluation type trait.
PointerType pointer
Pointer return type.
Definition: SVecScalarDivExpr.h:209
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecScalarDivExpr.h:435
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecScalarDivExpr.h:389
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SVecScalarDivExpr.h:165
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the DivExprTrait class template.
ReferenceType reference
Reference return type.
Definition: SVecScalarDivExpr.h:210
SVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the SVecScalarDivExpr class.
Definition: SVecScalarDivExpr.h:321
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:72
RightOperand scalar_
Right hand side scalar of the multiplication expression.
Definition: SVecScalarDivExpr.h:310
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
const EnableIf_< IsNumeric< T2 >, DivExprTrait_< T1, T2 > > operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:966
Header file for the ValueIndexPair class.
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:291
IteratorType vector_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:309
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SVecScalarDivExpr.h:125
Header file for the Or class template.
Iterator over the elements of the sparse vector/scalar multiplication expression. ...
Definition: SVecScalarDivExpr.h:190
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
ResultType_< VT > RT
Result type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:110
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarDivExpr.h:302
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarDivExpr.h:200
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:71
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Constraint on the data type.
#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:60
Header file for the exception macros of the math module.
ReturnType_< VT > RN
Return type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:111
Constraint on the data type.
Header file for all forward declarations for expression class templates.
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarDivExpr.h:228
Constraint on the data type.
Header file for the EnableIf class template.
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecScalarDivExpr.h:412
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarDivExpr.h:457
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SVecScalarDivExpr.h:477
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SVecScalarDivExpr.h:179
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarDivExpr.h:259
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
Header file for the IsNumeric type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecScalarDivExpr.h:346
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecScalarDivExpr.h:379
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
Utility type for generic codes.
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SVecScalarDivExpr.h:445
Header file for the division trait.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
ValueType & ReferenceType
Reference return type.
Definition: SVecScalarDivExpr.h:203
If_< IsExpression< VT >, const VT, const VT & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:176
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Expression object for divisions of a sparse vector by a scalar.The SVecScalarDivExpr class represents...
Definition: Forward.h:117
LeftOperand vector_
Left-hand side sparse vector of the division expression.
Definition: SVecScalarDivExpr.h:476
Element ValueType
Type of the underlying pointers.
Definition: SVecScalarDivExpr.h:201
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:81
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:239
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecScalarDivExpr.h:167
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
size_t index() const
Access to the current index of the sparse element.
Definition: SVecScalarDivExpr.h:269
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecScalarDivExpr.h:170
IfTrue_< useAssign, const ResultType, const SVecScalarDivExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecScalarDivExpr.h:173
Header file for the IsComputation type trait class.
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:196
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecScalarDivExpr.h:333
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#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
SVecScalarDivExpr< VT, ST, TF > This
Type of this SVecScalarDivExpr instance.
Definition: SVecScalarDivExpr.h:164
Header file for the SubvectorExprTrait class template.
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:363
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
Header file for the IsColumnVector type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarDivExpr.h:207
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:249
Header file for the Size type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#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
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:369
Header file for the IsExpression type trait class.
ValueType value_type
Type of the underlying pointers.
Definition: SVecScalarDivExpr.h:208
Header file for the FunctionTrace class.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarDivExpr.h:166
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecScalarDivExpr.h:400