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>
67 #include <blaze/util/Assert.h>
71 #include <blaze/util/EnableIf.h>
73 #include <blaze/util/InvalidType.h>
74 #include <blaze/util/mpl/And.h>
75 #include <blaze/util/mpl/If.h>
76 #include <blaze/util/mpl/Or.h>
77 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS SVECSCALARDIVEXPR
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
100 template< typename VT // Type of the left-hand side sparse vector
101  , typename ST // Type of the right-hand side scalar value
102  , bool TF > // Transpose flag
103 class SVecScalarDivExpr
104  : public VecScalarDivExpr< SparseVector< SVecScalarDivExpr<VT,ST,TF>, TF > >
105  , private Computation
106 {
107  private:
108  //**Type definitions****************************************************************************
109  using RT = ResultType_<VT>;
110  using RN = ReturnType_<VT>;
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  enum : bool { returnExpr = !IsTemporary<RN>::value };
122 
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
135  enum : bool { useAssign = RequiresEvaluation<VT>::value };
136 
138  template< typename VT2 >
140  struct UseAssign {
141  enum : bool { value = useAssign };
142  };
144  //**********************************************************************************************
145 
146  //**Parallel evaluation strategy****************************************************************
148 
154  template< typename VT2 >
155  struct UseSMPAssign {
156  enum : bool { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
157  };
159  //**********************************************************************************************
160 
161  public:
162  //**Type definitions****************************************************************************
167 
170 
173 
175  using LeftOperand = If_< IsExpression<VT>, const VT, const VT& >;
176 
178  using RightOperand = ST;
179  //**********************************************************************************************
180 
181  //**Compilation flags***************************************************************************
183  enum : bool { smpAssignable = false };
184  //**********************************************************************************************
185 
186  //**ConstIterator class definition**************************************************************
190  {
191  public:
192  //**Type definitions*************************************************************************
195 
198 
199  using IteratorCategory = std::forward_iterator_tag;
200  using ValueType = Element;
204 
205  // STL iterator requirements
211  //*******************************************************************************************
212 
213  //**Constructor******************************************************************************
216  inline ConstIterator( IteratorType vector, RightOperand scalar )
217  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
218  , scalar_( scalar ) // Right hand side scalar of the multiplication expression
219  {}
220  //*******************************************************************************************
221 
222  //**Prefix increment operator****************************************************************
228  ++vector_;
229  return *this;
230  }
231  //*******************************************************************************************
232 
233  //**Element access operator******************************************************************
238  inline const Element operator*() const {
239  return Element( vector_->value() / scalar_, vector_->index() );
240  }
241  //*******************************************************************************************
242 
243  //**Element access operator******************************************************************
248  inline const ConstIterator* operator->() const {
249  return this;
250  }
251  //*******************************************************************************************
252 
253  //**Value function***************************************************************************
258  inline ReturnType value() const {
259  return vector_->value() / scalar_;
260  }
261  //*******************************************************************************************
262 
263  //**Index function***************************************************************************
268  inline size_t index() const {
269  return vector_->index();
270  }
271  //*******************************************************************************************
272 
273  //**Equality operator************************************************************************
279  inline bool operator==( const ConstIterator& rhs ) const {
280  return vector_ == rhs.vector_;
281  }
282  //*******************************************************************************************
283 
284  //**Inequality operator**********************************************************************
290  inline bool operator!=( const ConstIterator& rhs ) const {
291  return vector_ != rhs.vector_;
292  }
293  //*******************************************************************************************
294 
295  //**Subtraction operator*********************************************************************
301  inline DifferenceType operator-( const ConstIterator& rhs ) const {
302  return vector_ - rhs.vector_;
303  }
304  //*******************************************************************************************
305 
306  private:
307  //**Member variables*************************************************************************
310  //*******************************************************************************************
311  };
312  //**********************************************************************************************
313 
314  //**Constructor*********************************************************************************
320  explicit inline SVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
321  : vector_( vector ) // Left-hand side sparse vector of the division expression
322  , scalar_( scalar ) // Right-hand side scalar of the division expression
323  {}
324  //**********************************************************************************************
325 
326  //**Subscript operator**************************************************************************
332  inline ReturnType operator[]( size_t index ) const {
333  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
334  return vector_[index] / scalar_;
335  }
336  //**********************************************************************************************
337 
338  //**At function*********************************************************************************
345  inline ReturnType at( size_t index ) const {
346  if( index >= vector_.size() ) {
347  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
348  }
349  return (*this)[index];
350  }
351  //**********************************************************************************************
352 
353  //**Begin function******************************************************************************
358  inline ConstIterator begin() const {
359  return ConstIterator( vector_.begin(), scalar_ );
360  }
361  //**********************************************************************************************
362 
363  //**End function********************************************************************************
368  inline ConstIterator end() const {
369  return ConstIterator( vector_.end(), scalar_ );
370  }
371  //**********************************************************************************************
372 
373  //**Size function*******************************************************************************
378  inline size_t size() const noexcept {
379  return vector_.size();
380  }
381  //**********************************************************************************************
382 
383  //**NonZeros function***************************************************************************
388  inline size_t nonZeros() const {
389  return vector_.nonZeros();
390  }
391  //**********************************************************************************************
392 
393  //**Find function*******************************************************************************
399  inline ConstIterator find( size_t index ) const {
401  return ConstIterator( vector_.find( index ), scalar_ );
402  }
403  //**********************************************************************************************
404 
405  //**LowerBound function*************************************************************************
411  inline ConstIterator lowerBound( size_t index ) const {
413  return ConstIterator( vector_.lowerBound( index ), scalar_ );
414  }
415  //**********************************************************************************************
416 
417  //**UpperBound function*************************************************************************
423  inline ConstIterator upperBound( size_t index ) const {
425  return ConstIterator( vector_.upperBound( index ), scalar_ );
426  }
427  //**********************************************************************************************
428 
429  //**Left operand access*************************************************************************
434  inline LeftOperand leftOperand() const noexcept {
435  return vector_;
436  }
437  //**********************************************************************************************
438 
439  //**Right operand access************************************************************************
444  inline RightOperand rightOperand() const noexcept {
445  return scalar_;
446  }
447  //**********************************************************************************************
448 
449  //**********************************************************************************************
455  template< typename T >
456  inline bool canAlias( const T* alias ) const noexcept {
457  return vector_.canAlias( alias );
458  }
459  //**********************************************************************************************
460 
461  //**********************************************************************************************
467  template< typename T >
468  inline bool isAliased( const T* alias ) const noexcept {
469  return vector_.isAliased( alias );
470  }
471  //**********************************************************************************************
472 
473  private:
474  //**Member variables****************************************************************************
477  //**********************************************************************************************
478 
479  //**Assignment to dense vectors*****************************************************************
493  template< typename VT2 > // Type of the target dense vector
494  friend inline EnableIf_< UseAssign<VT2> >
495  assign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
496  {
498 
499  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
500 
501  assign( ~lhs, rhs.vector_ );
502  (~lhs) /= rhs.scalar_;
503  }
505  //**********************************************************************************************
506 
507  //**Assignment to sparse vectors****************************************************************
521  template< typename VT2 > // Type of the target sparse vector
522  friend inline EnableIf_< UseAssign<VT2> >
523  assign( SparseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
524  {
526 
527  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
528 
529  assign( ~lhs, rhs.vector_ );
530  (~lhs) /= rhs.scalar_;
531  }
533  //**********************************************************************************************
534 
535  //**Addition assignment to dense vectors********************************************************
549  template< typename VT2 > // Type of the target dense vector
550  friend inline EnableIf_< UseAssign<VT2> >
551  addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
552  {
554 
558 
559  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
560 
561  const ResultType tmp( serial( rhs ) );
562  addAssign( ~lhs, tmp );
563  }
565  //**********************************************************************************************
566 
567  //**Addition assignment to sparse vectors*******************************************************
568  // No special implementation for the addition assignment to sparse vectors.
569  //**********************************************************************************************
570 
571  //**Subtraction assignment to dense vectors*****************************************************
585  template< typename VT2 > // Type of the target dense vector
586  friend inline EnableIf_< UseAssign<VT2> >
587  subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
588  {
590 
594 
595  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
596 
597  const ResultType tmp( serial( rhs ) );
598  subAssign( ~lhs, tmp );
599  }
601  //**********************************************************************************************
602 
603  //**Subtraction assignment to sparse vectors****************************************************
604  // No special implementation for the subtraction assignment to sparse vectors.
605  //**********************************************************************************************
606 
607  //**Multiplication assignment to dense vectors**************************************************
621  template< typename VT2 > // Type of the target dense vector
622  friend inline EnableIf_< UseAssign<VT2> >
623  multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
624  {
626 
630 
631  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
632 
633  const ResultType tmp( serial( rhs ) );
634  multAssign( ~lhs, tmp );
635  }
637  //**********************************************************************************************
638 
639  //**Multiplication assignment to sparse vectors*************************************************
640  // No special implementation for the multiplication assignment to sparse vectors.
641  //**********************************************************************************************
642 
643  //**SMP assignment to dense vectors*************************************************************
644  // No special implementation for the SMP assignment to dense vectors.
645  //**********************************************************************************************
646 
647  //**SMP assignment to sparse vectors************************************************************
648  // No special implementation for the SMP assignment to sparse vectors.
649  //**********************************************************************************************
650 
651  //**SMP addition assignment to dense vectors****************************************************
665  template< typename VT2 > // Type of the target dense vector
666  friend inline EnableIf_< UseSMPAssign<VT2> >
667  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
668  {
670 
674 
675  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
676 
677  const ResultType tmp( rhs );
678  smpAddAssign( ~lhs, tmp );
679  }
681  //**********************************************************************************************
682 
683  //**SMP addition assignment to sparse vectors***************************************************
684  // No special implementation for the SMP addition assignment to sparse vectors.
685  //**********************************************************************************************
686 
687  //**SMP subtraction assignment to dense vectors*************************************************
701  template< typename VT2 > // Type of the target dense vector
702  friend inline EnableIf_< UseSMPAssign<VT2> >
703  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
704  {
706 
710 
711  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
712 
713  const ResultType tmp( rhs );
714  smpSubAssign( ~lhs, tmp );
715  }
717  //**********************************************************************************************
718 
719  //**SMP subtraction assignment to sparse vectors************************************************
720  // No special implementation for the SMP subtraction assignment to sparse vectors.
721  //**********************************************************************************************
722 
723  //**SMP multiplication assignment to dense vectors**********************************************
737  template< typename VT2 > // Type of the target dense vector
738  friend inline EnableIf_< UseSMPAssign<VT2> >
739  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
740  {
742 
746 
747  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
748 
749  const ResultType tmp( rhs );
750  smpMultAssign( ~lhs, tmp );
751  }
753  //**********************************************************************************************
754 
755  //**SMP multiplication assignment to sparse vectors*********************************************
756  // No special implementation for the SMP multiplication assignment to sparse vectors.
757  //**********************************************************************************************
758 
759  //**Compile time checks*************************************************************************
768  //**********************************************************************************************
769 };
770 //*************************************************************************************************
771 
772 
773 
774 
775 //=================================================================================================
776 //
777 // GLOBAL BINARY ARITHMETIC OPERATORS
778 //
779 //=================================================================================================
780 
781 //*************************************************************************************************
786 template< typename VT // Type of the left-hand side sparse vector
787  , typename ST // Type of the right-hand side scalar
788  , bool TF > // Transpose flag
789 struct SVecScalarDivExprHelper
790 {
791  private:
792  //**********************************************************************************************
793  using ScalarType = If_< Or< IsFloatingPoint< UnderlyingBuiltin_<VT> >
794  , IsFloatingPoint< UnderlyingBuiltin_<ST> > >
795  , If_< And< IsComplex< UnderlyingNumeric_<VT> >
796  , IsBuiltin<ST> >
797  , DivTrait_< UnderlyingBuiltin_<VT>, ST >
798  , DivTrait_< UnderlyingNumeric_<VT>, ST > >
799  , ST >;
800  //**********************************************************************************************
801 
802  public:
803  //**********************************************************************************************
804  using Type = If_< IsInvertible<ScalarType>
805  , SVecScalarMultExpr<VT,ScalarType,TF>
806  , SVecScalarDivExpr<VT,ScalarType,TF> >;
807  //**********************************************************************************************
808 };
810 //*************************************************************************************************
811 
812 
813 //*************************************************************************************************
836 template< typename VT // Type of the left-hand side sparse vector
837  , typename ST // Type of the right-hand side scalar
838  , bool TF // Transpose flag
839  , typename = EnableIf_< IsNumeric<ST> > >
840 inline decltype(auto) operator/( const SparseVector<VT,TF>& vec, ST scalar )
841 {
843 
844  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
845 
846  using ReturnType = typename SVecScalarDivExprHelper<VT,ST,TF>::Type;
847  using ScalarType = RightOperand_<ReturnType>;
848 
850  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
851  }
852  else {
853  return ReturnType( ~vec, scalar );
854  }
855 }
856 //*************************************************************************************************
857 
858 
859 
860 
861 //=================================================================================================
862 //
863 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
864 //
865 //=================================================================================================
866 
867 //*************************************************************************************************
880 template< typename VT // Type of the sparse vector of the left-hand side expression
881  , typename ST1 // Type of the scalar of the left-hand side expression
882  , bool TF // Transpose flag of the sparse vector
883  , typename ST2 // Type of the right-hand side scalar
885 inline decltype(auto) operator*( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
886 {
888 
889  return vec.leftOperand() * ( scalar / vec.rightOperand() );
890 }
892 //*************************************************************************************************
893 
894 
895 //*************************************************************************************************
908 template< typename ST1 // Type of the left-hand side scalar
909  , typename VT // Type of the sparse vector of the right-hand side expression
910  , typename ST2 // Type of the scalar of the right-hand side expression
911  , bool TF // Transpose flag of the sparse vector
912  , typename = EnableIf_< And< IsNumeric<ST1>, Or< IsInvertible<ST1>, IsInvertible<ST2> > > > >
913 inline decltype(auto) operator*( ST1 scalar, const SVecScalarDivExpr<VT,ST2,TF>& vec )
914 {
916 
917  return vec.leftOperand() * ( scalar / vec.rightOperand() );
918 }
920 //*************************************************************************************************
921 
922 
923 //*************************************************************************************************
936 template< typename VT // Type of the sparse vector of the left-hand side expression
937  , typename ST1 // Type of the scalar of the left-hand side expression
938  , bool TF // Transpose flag of the sparse vector
939  , typename ST2 // Type of the right-hand side scalar
940  , typename = EnableIf_< IsNumeric<ST2> > >
941 inline decltype(auto) operator/( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
942 {
944 
945  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
946 
947  using MultType = MultTrait_<ST1,ST2>;
948  using ReturnType = typename SVecScalarDivExprHelper<VT,MultType,TF>::Type;
949  using ScalarType = RightOperand_<ReturnType>;
950 
952  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
953  }
954  else {
955  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
956  }
957 }
959 //*************************************************************************************************
960 
961 
962 
963 
964 //=================================================================================================
965 //
966 // SIZE SPECIALIZATIONS
967 //
968 //=================================================================================================
969 
970 //*************************************************************************************************
972 template< typename VT, typename ST, bool TF >
973 struct Size< SVecScalarDivExpr<VT,ST,TF> >
974  : public Size<VT>
975 {};
977 //*************************************************************************************************
978 
979 } // namespace blaze
980 
981 #endif
Header file for the UnderlyingNumeric type trait.
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:216
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecScalarDivExpr.h:378
#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
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 from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:97
decltype(auto) operator/(const DenseMatrix< MT, SO > &mat, ST scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:1073
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
Header file for the serial shim.
ConstIterator_< RemoveReference_< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:197
size_t index() const
Access to the current index of the sparse element.
Definition: SVecScalarDivExpr.h:268
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.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:368
If_< IsExpression< VT >, const VT, const VT &> LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:175
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:250
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarDivExpr.h:206
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:248
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecScalarDivExpr.h:169
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
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SVecScalarDivExpr.h:178
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:363
Header file for the DivExprTrait class template.
DivExprTrait_< RN, ST > ExprReturnType
Expression return type for the subscript operator.
Definition: SVecScalarDivExpr.h:124
SVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the SVecScalarDivExpr class.
Definition: SVecScalarDivExpr.h:320
DivTrait_< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SVecScalarDivExpr.h:164
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarDivExpr.h:301
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:309
ReturnType_< VT > RN
Return type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:110
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecScalarDivExpr.h:423
IfTrue_< useAssign, const ResultType, const SVecScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecScalarDivExpr.h:172
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.
Header file for the IsFloatingPoint type trait.
IteratorType vector_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:308
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
Header file for the Or class template.
Iterator over the elements of the sparse vector/scalar multiplication expression. ...
Definition: SVecScalarDivExpr.h:189
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarDivExpr.h:258
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarDivExpr.h:468
Header file for the exception macros of the math module.
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
Constraint on the data type.
Header file for all forward declarations for expression class templates.
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarDivExpr.h:227
Constraint on the data type.
Header file for the EnableIf class template.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecScalarDivExpr.h:388
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecScalarDivExpr.h:399
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SVecScalarDivExpr.h:476
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
CompositeType_< VT > CT
Composite type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:111
Header file for the IsNumeric type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarDivExpr.h:456
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:358
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:238
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarDivExpr.h:199
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SVecScalarDivExpr.h:444
Header file for run time assertion macros.
Utility type for generic codes.
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:154
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecScalarDivExpr.h:166
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsInvertible.h:83
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecScalarDivExpr.h:434
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Expression object for divisions of a sparse vector by a scalar.The SVecScalarDivExpr class represents...
Definition: Forward.h:138
ResultType_< VT > RT
Result type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:109
LeftOperand vector_
Left-hand side sparse vector of the division expression.
Definition: SVecScalarDivExpr.h:475
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:224
#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 Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecScalarDivExpr.h:411
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:279
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
typename DivExprTrait< T1, T2 >::Type DivExprTrait_
Auxiliary alias declaration for the DivExprTrait class template.The DivExprTrait_ alias declaration p...
Definition: DivExprTrait.h:112
Compile time logical or evaluation.The Or alias declaration performs at compile time a logical or (&#39;&&&#3...
Definition: Or.h:76
Compile time evaluation of the size of a vector.The Size type trait evaluates the size of the given v...
Definition: Size.h:74
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:130
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecScalarDivExpr.h:345
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:290
Header file for the IsComplex type trait.
typename T::RightOperand RightOperand_
Alias declaration for nested RightOperand type definitions.The RightOperand_ alias declaration provid...
Definition: Aliases.h:383
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:423
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarDivExpr.h:165
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
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecScalarDivExpr.h:332
#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
Header file for the IsExpression type trait class.
Header file for the function trace functionality.