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 <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
68 #include <blaze/util/Assert.h>
72 #include <blaze/util/DisableIf.h>
73 #include <blaze/util/EnableIf.h>
75 #include <blaze/util/mpl/If.h>
76 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS SVECSCALARDIVEXPR
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< typename VT // Type of the left-hand side sparse vector
100  , typename ST // Type of the right-hand side scalar value
101  , bool TF > // Transpose flag
102 class SVecScalarDivExpr
103  : public VecScalarDivExpr< SparseVector< SVecScalarDivExpr<VT,ST,TF>, TF > >
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
111  //**********************************************************************************************
112 
113  //**Return type evaluation**********************************************************************
115 
120  static constexpr bool returnExpr = !IsTemporary_v<RN>;
121 
123  using ExprReturnType = decltype( std::declval<RN>() / std::declval<ST>() );
124  //**********************************************************************************************
125 
126  //**Serial evaluation strategy******************************************************************
128 
134  static constexpr bool useAssign = RequiresEvaluation_v<VT>;
135 
137  template< typename VT2 >
139  static constexpr bool UseAssign_v = useAssign;
141  //**********************************************************************************************
142 
143  //**Parallel evaluation strategy****************************************************************
145 
151  template< typename VT2 >
152  static constexpr bool UseSMPAssign_v =
155  //**********************************************************************************************
156 
157  public:
158  //**Type definitions****************************************************************************
164 
167 
170 
172  using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
173 
175  using RightOperand = ST;
176  //**********************************************************************************************
177 
178  //**Compilation flags***************************************************************************
180  static constexpr bool smpAssignable = false;
181  //**********************************************************************************************
182 
183  //**ConstIterator class definition**************************************************************
187  {
188  public:
189  //**Type definitions*************************************************************************
192 
195 
196  using IteratorCategory = std::forward_iterator_tag;
197  using ValueType = Element;
201 
202  // STL iterator requirements
208  //*******************************************************************************************
209 
210  //**Constructor******************************************************************************
213  inline ConstIterator( IteratorType vector, RightOperand scalar )
214  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
215  , scalar_( scalar ) // Right hand side scalar of the multiplication expression
216  {}
217  //*******************************************************************************************
218 
219  //**Prefix increment operator****************************************************************
225  ++vector_;
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Element access operator******************************************************************
235  inline const Element operator*() const {
236  return Element( vector_->value() / scalar_, vector_->index() );
237  }
238  //*******************************************************************************************
239 
240  //**Element access operator******************************************************************
245  inline const ConstIterator* operator->() const {
246  return this;
247  }
248  //*******************************************************************************************
249 
250  //**Value function***************************************************************************
255  inline ReturnType value() const {
256  return vector_->value() / scalar_;
257  }
258  //*******************************************************************************************
259 
260  //**Index function***************************************************************************
265  inline size_t index() const {
266  return vector_->index();
267  }
268  //*******************************************************************************************
269 
270  //**Equality operator************************************************************************
276  inline bool operator==( const ConstIterator& rhs ) const {
277  return vector_ == rhs.vector_;
278  }
279  //*******************************************************************************************
280 
281  //**Inequality operator**********************************************************************
287  inline bool operator!=( const ConstIterator& rhs ) const {
288  return vector_ != rhs.vector_;
289  }
290  //*******************************************************************************************
291 
292  //**Subtraction operator*********************************************************************
298  inline DifferenceType operator-( const ConstIterator& rhs ) const {
299  return vector_ - rhs.vector_;
300  }
301  //*******************************************************************************************
302 
303  private:
304  //**Member variables*************************************************************************
307  //*******************************************************************************************
308  };
309  //**********************************************************************************************
310 
311  //**Constructor*********************************************************************************
317  explicit inline SVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
318  : vector_( vector ) // Left-hand side sparse vector of the division expression
319  , scalar_( scalar ) // Right-hand side scalar of the division expression
320  {}
321  //**********************************************************************************************
322 
323  //**Subscript operator**************************************************************************
329  inline ReturnType operator[]( size_t index ) const {
330  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
331  return vector_[index] / scalar_;
332  }
333  //**********************************************************************************************
334 
335  //**At function*********************************************************************************
342  inline ReturnType at( size_t index ) const {
343  if( index >= vector_.size() ) {
344  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
345  }
346  return (*this)[index];
347  }
348  //**********************************************************************************************
349 
350  //**Begin function******************************************************************************
355  inline ConstIterator begin() const {
356  return ConstIterator( vector_.begin(), scalar_ );
357  }
358  //**********************************************************************************************
359 
360  //**End function********************************************************************************
365  inline ConstIterator end() const {
366  return ConstIterator( vector_.end(), scalar_ );
367  }
368  //**********************************************************************************************
369 
370  //**Size function*******************************************************************************
375  inline size_t size() const noexcept {
376  return vector_.size();
377  }
378  //**********************************************************************************************
379 
380  //**NonZeros function***************************************************************************
385  inline size_t nonZeros() const {
386  return vector_.nonZeros();
387  }
388  //**********************************************************************************************
389 
390  //**Find function*******************************************************************************
396  inline ConstIterator find( size_t index ) const {
398  return ConstIterator( vector_.find( index ), scalar_ );
399  }
400  //**********************************************************************************************
401 
402  //**LowerBound function*************************************************************************
408  inline ConstIterator lowerBound( size_t index ) const {
410  return ConstIterator( vector_.lowerBound( index ), scalar_ );
411  }
412  //**********************************************************************************************
413 
414  //**UpperBound function*************************************************************************
420  inline ConstIterator upperBound( size_t index ) const {
422  return ConstIterator( vector_.upperBound( index ), scalar_ );
423  }
424  //**********************************************************************************************
425 
426  //**Left operand access*************************************************************************
431  inline LeftOperand leftOperand() const noexcept {
432  return vector_;
433  }
434  //**********************************************************************************************
435 
436  //**Right operand access************************************************************************
441  inline RightOperand rightOperand() const noexcept {
442  return scalar_;
443  }
444  //**********************************************************************************************
445 
446  //**********************************************************************************************
452  template< typename T >
453  inline bool canAlias( const T* alias ) const noexcept {
454  return vector_.canAlias( alias );
455  }
456  //**********************************************************************************************
457 
458  //**********************************************************************************************
464  template< typename T >
465  inline bool isAliased( const T* alias ) const noexcept {
466  return vector_.isAliased( alias );
467  }
468  //**********************************************************************************************
469 
470  private:
471  //**Member variables****************************************************************************
474  //**********************************************************************************************
475 
476  //**Assignment to dense vectors*****************************************************************
490  template< typename VT2 > // Type of the target dense vector
491  friend inline auto assign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
493  {
495 
496  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
497 
498  assign( ~lhs, rhs.vector_ );
499  (~lhs) /= rhs.scalar_;
500  }
502  //**********************************************************************************************
503 
504  //**Assignment to sparse vectors****************************************************************
518  template< typename VT2 > // Type of the target sparse vector
519  friend inline auto assign( SparseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
521  {
523 
524  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
525 
526  assign( ~lhs, rhs.vector_ );
527  (~lhs) /= rhs.scalar_;
528  }
530  //**********************************************************************************************
531 
532  //**Addition assignment to dense vectors********************************************************
546  template< typename VT2 > // Type of the target dense vector
547  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
548  -> EnableIf_t< UseAssign_v<VT2> >
549  {
551 
555 
556  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
557 
558  const ResultType tmp( serial( rhs ) );
559  addAssign( ~lhs, tmp );
560  }
562  //**********************************************************************************************
563 
564  //**Addition assignment to sparse vectors*******************************************************
565  // No special implementation for the addition assignment to sparse vectors.
566  //**********************************************************************************************
567 
568  //**Subtraction assignment to dense vectors*****************************************************
582  template< typename VT2 > // Type of the target dense vector
583  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
584  -> EnableIf_t< UseAssign_v<VT2> >
585  {
587 
591 
592  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
593 
594  const ResultType tmp( serial( rhs ) );
595  subAssign( ~lhs, tmp );
596  }
598  //**********************************************************************************************
599 
600  //**Subtraction assignment to sparse vectors****************************************************
601  // No special implementation for the subtraction assignment to sparse vectors.
602  //**********************************************************************************************
603 
604  //**Multiplication assignment to dense vectors**************************************************
618  template< typename VT2 > // Type of the target dense vector
619  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
620  -> EnableIf_t< UseAssign_v<VT2> >
621  {
623 
627 
628  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
629 
630  const ResultType tmp( serial( rhs ) );
631  multAssign( ~lhs, tmp );
632  }
634  //**********************************************************************************************
635 
636  //**Multiplication assignment to sparse vectors*************************************************
637  // No special implementation for the multiplication assignment to sparse vectors.
638  //**********************************************************************************************
639 
640  //**SMP assignment to dense vectors*************************************************************
641  // No special implementation for the SMP assignment to dense vectors.
642  //**********************************************************************************************
643 
644  //**SMP assignment to sparse vectors************************************************************
645  // No special implementation for the SMP assignment to sparse vectors.
646  //**********************************************************************************************
647 
648  //**SMP addition assignment to dense vectors****************************************************
662  template< typename VT2 > // Type of the target dense vector
663  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
664  -> EnableIf_t< UseSMPAssign_v<VT2> >
665  {
667 
671 
672  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
673 
674  const ResultType tmp( rhs );
675  smpAddAssign( ~lhs, tmp );
676  }
678  //**********************************************************************************************
679 
680  //**SMP addition assignment to sparse vectors***************************************************
681  // No special implementation for the SMP addition assignment to sparse vectors.
682  //**********************************************************************************************
683 
684  //**SMP subtraction assignment to dense vectors*************************************************
698  template< typename VT2 > // Type of the target dense vector
699  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
700  -> EnableIf_t< UseSMPAssign_v<VT2> >
701  {
703 
707 
708  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
709 
710  const ResultType tmp( rhs );
711  smpSubAssign( ~lhs, tmp );
712  }
714  //**********************************************************************************************
715 
716  //**SMP subtraction assignment to sparse vectors************************************************
717  // No special implementation for the SMP subtraction assignment to sparse vectors.
718  //**********************************************************************************************
719 
720  //**SMP multiplication assignment to dense vectors**********************************************
734  template< typename VT2 > // Type of the target dense vector
735  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
736  -> EnableIf_t< UseSMPAssign_v<VT2> >
737  {
739 
743 
744  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
745 
746  const ResultType tmp( rhs );
747  smpMultAssign( ~lhs, tmp );
748  }
750  //**********************************************************************************************
751 
752  //**SMP multiplication assignment to sparse vectors*********************************************
753  // No special implementation for the SMP multiplication assignment to sparse vectors.
754  //**********************************************************************************************
755 
756  //**Compile time checks*************************************************************************
766  //**********************************************************************************************
767 };
768 //*************************************************************************************************
769 
770 
771 
772 
773 //=================================================================================================
774 //
775 // GLOBAL BINARY ARITHMETIC OPERATORS
776 //
777 //=================================================================================================
778 
779 //*************************************************************************************************
784 template< typename VT // Type of the left-hand side sparse vector
785  , typename ST // Type of the right-hand side scalar
786  , bool TF > // Transpose flag
787 struct SVecScalarDivExprHelper
788 {
789  private:
790  //**********************************************************************************************
791  using ScalarType = If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<VT> > ||
792  IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
793  , If_t< IsComplex_v< UnderlyingNumeric_t<VT> > && IsBuiltin_v<ST>
794  , DivTrait_t< UnderlyingBuiltin_t<VT>, ST >
795  , DivTrait_t< UnderlyingNumeric_t<VT>, ST > >
796  , ST >;
797  //**********************************************************************************************
798 
799  public:
800  //**********************************************************************************************
801  using Type = If_t< IsInvertible_v<ScalarType>
802  , SVecScalarMultExpr<VT,ScalarType,TF>
803  , SVecScalarDivExpr<VT,ScalarType,TF> >;
804  //**********************************************************************************************
805 };
807 //*************************************************************************************************
808 
809 
810 //*************************************************************************************************
823 template< typename VT // Type of the left-hand side sparse vector
824  , bool TF // Transpose flag of the left-hand side sparse vector
825  , typename ST // Type of the right-hand side scalar
826  , DisableIf_t< IsZero_v<VT> >* = nullptr >
827 inline const typename SVecScalarDivExprHelper<VT,ST,TF>::Type
828  svecscalardiv( const SparseVector<VT,TF>& vec, ST scalar )
829 {
831 
832  using ReturnType = typename SVecScalarDivExprHelper<VT,ST,TF>::Type;
833  using ScalarType = RightOperand_t<ReturnType>;
834 
835  if( IsMultExpr_v<ReturnType> ) {
836  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
837  }
838  else {
839  return ReturnType( ~vec, scalar );
840  }
841 }
843 //*************************************************************************************************
844 
845 
846 //*************************************************************************************************
859 template< typename VT // Type of the left-hand side sparse vector
860  , bool TF // Transpose flag of the left-hand side sparse vector
861  , typename ST // Type of the right-hand side scalar
862  , EnableIf_t< IsZero_v<VT> >* = nullptr >
863 inline decltype(auto)
864  svecscalardiv( const SparseVector<VT,TF>& vec, ST scalar )
865 {
867 
868  UNUSED_PARAMETER( scalar );
869 
870  using ReturnType = const DivTrait_t< ResultType_t<VT>, ST >;
871 
874 
875  return ReturnType( (~vec).size() );
876 }
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
904 template< typename VT // Type of the left-hand side sparse vector
905  , typename ST // Type of the right-hand side scalar
906  , bool TF // Transpose flag
907  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
908 inline decltype(auto) operator/( const SparseVector<VT,TF>& vec, ST scalar )
909 {
911 
912  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
913 
914  return svecscalardiv( ~vec, scalar );
915 }
916 //*************************************************************************************************
917 
918 
919 
920 
921 //=================================================================================================
922 //
923 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
924 //
925 //=================================================================================================
926 
927 //*************************************************************************************************
940 template< typename VT // Type of the sparse vector of the left-hand side expression
941  , typename ST1 // Type of the scalar of the left-hand side expression
942  , bool TF // Transpose flag of the sparse vector
943  , typename ST2 // Type of the right-hand side scalar
944  , EnableIf_t< IsNumeric_v<ST2> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
945 inline decltype(auto) operator*( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
946 {
948 
949  return vec.leftOperand() * ( scalar / vec.rightOperand() );
950 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
968 template< typename ST1 // Type of the left-hand side scalar
969  , typename VT // Type of the sparse vector of the right-hand side expression
970  , typename ST2 // Type of the scalar of the right-hand side expression
971  , bool TF // Transpose flag of the sparse vector
972  , EnableIf_t< IsNumeric_v<ST1> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
973 inline decltype(auto) operator*( ST1 scalar, const SVecScalarDivExpr<VT,ST2,TF>& vec )
974 {
976 
977  return vec.leftOperand() * ( scalar / vec.rightOperand() );
978 }
980 //*************************************************************************************************
981 
982 
983 //*************************************************************************************************
996 template< typename VT // Type of the sparse vector of the left-hand side expression
997  , typename ST1 // Type of the scalar of the left-hand side expression
998  , bool TF // Transpose flag of the sparse vector
999  , typename ST2 // Type of the right-hand side scalar
1000  , EnableIf_t< IsNumeric_v<ST2> >* = nullptr >
1001 inline decltype(auto) operator/( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1002 {
1004 
1005  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1006 
1007  using MultType = MultTrait_t<ST1,ST2>;
1008  using ReturnType = typename SVecScalarDivExprHelper<VT,MultType,TF>::Type;
1009  using ScalarType = RightOperand_t<ReturnType>;
1010 
1011  if( IsMultExpr_v<ReturnType> ) {
1012  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1013  }
1014  else {
1015  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1016  }
1017 }
1019 //*************************************************************************************************
1020 
1021 } // namespace blaze
1022 
1023 #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:213
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecScalarDivExpr.h:375
#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
Header file for basic type definitions.
Header file for the SparseVector base class.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecScalarDivExpr.h:180
ResultType_t< VT > RT
Result type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:108
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.The DivTrait_t alias declaration provides...
Definition: DivTrait.h:239
size_t index() const
Access to the current index of the sparse element.
Definition: SVecScalarDivExpr.h:265
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the VecScalarDivExpr base class.
Constraint on the data type.
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:365
DivTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SVecScalarDivExpr.h:161
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarDivExpr.h:203
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:191
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:245
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SVecScalarDivExpr.h:175
SVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the SVecScalarDivExpr class.
Definition: SVecScalarDivExpr.h:317
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarDivExpr.h:298
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SVecScalarDivExpr.h:163
RightOperand scalar_
Right hand side scalar of the multiplication expression.
Definition: SVecScalarDivExpr.h:306
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecScalarDivExpr.h:420
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecScalarDivExpr.h:200
Header file for the ValueIndexPair class.
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
Element ValueType
Type of the underlying pointers.
Definition: SVecScalarDivExpr.h:197
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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:305
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type...
Definition: Zero.h:61
Header file for the UnderlyingBuiltin type trait.
Header file for the IsMultExpr type trait class.
Iterator over the elements of the sparse vector/scalar multiplication expression. ...
Definition: SVecScalarDivExpr.h:186
#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:3086
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
#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
ValueType * PointerType
Pointer return type.
Definition: SVecScalarDivExpr.h:198
Constraint on the data type.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarDivExpr.h:255
ValueType & ReferenceType
Reference return type.
Definition: SVecScalarDivExpr.h:199
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarDivExpr.h:465
Header file for the exception macros of the math module.
decltype(std::declval< RN >()/std::declval< ST >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SVecScalarDivExpr.h:123
Constraint on the data type.
If_t< useAssign, const ResultType, const SVecScalarDivExpr &> CompositeType
Data type for composite expression templates.
Definition: SVecScalarDivExpr.h:169
Header file for all forward declarations for expression class templates.
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarDivExpr.h:224
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:385
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecScalarDivExpr.h:396
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SVecScalarDivExpr.h:473
Header file for the IsNumeric type trait.
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the multiplication expression.
Definition: SVecScalarDivExpr.h:134
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecScalarDivExpr.h:166
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarDivExpr.h:453
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:355
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:235
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarDivExpr.h:196
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SVecScalarDivExpr.h:441
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
ReturnType_t< VT > RN
Return type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:109
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the division trait.
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
Header file for the IsZero type trait.
If_t< IsExpression_v< VT >, const VT, const VT &> LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:172
#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
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
ConstIterator_t< RemoveReference_t< LeftOperand > > IteratorType
Iterator type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:194
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecScalarDivExpr.h:431
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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:147
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarDivExpr.h:162
LeftOperand vector_
Left-hand side sparse vector of the division expression.
Definition: SVecScalarDivExpr.h:472
Header file for the RemoveReference type trait.
Header file for the IsInvertible 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:81
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecScalarDivExpr.h:408
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:276
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecScalarDivExpr.h:342
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SVecScalarDivExpr.h:120
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:287
Header file for the IsComplex type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type...
Definition: Zero.h:81
#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:329
#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
CompositeType_t< VT > CT
Composite type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:110
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the IsExpression type trait class.
Header file for the function trace functionality.