Blaze  3.6
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/MaybeUnused.h>
76 #include <blaze/util/mpl/If.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****************************************************************************
112  //**********************************************************************************************
113 
114  //**Return type evaluation**********************************************************************
116 
121  static constexpr bool returnExpr = !IsTemporary_v<RN>;
122 
124  using ExprReturnType = decltype( std::declval<RN>() / std::declval<ST>() );
125  //**********************************************************************************************
126 
127  //**Serial evaluation strategy******************************************************************
129 
135  static constexpr bool useAssign = RequiresEvaluation_v<VT>;
136 
138  template< typename VT2 >
140  static constexpr bool UseAssign_v = useAssign;
142  //**********************************************************************************************
143 
144  //**Parallel evaluation strategy****************************************************************
146 
152  template< typename VT2 >
153  static constexpr bool UseSMPAssign_v =
154  ( ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign );
156  //**********************************************************************************************
157 
158  public:
159  //**Type definitions****************************************************************************
165 
168 
171 
173  using LeftOperand = If_t< IsExpression_v<VT>, const VT, const VT& >;
174 
176  using RightOperand = ST;
177  //**********************************************************************************************
178 
179  //**Compilation flags***************************************************************************
181  static constexpr bool smpAssignable = false;
182  //**********************************************************************************************
183 
184  //**ConstIterator class definition**************************************************************
188  {
189  public:
190  //**Type definitions*************************************************************************
193 
196 
197  using IteratorCategory = std::forward_iterator_tag;
198  using ValueType = Element;
202 
203  // STL iterator requirements
209  //*******************************************************************************************
210 
211  //**Constructor******************************************************************************
214  inline ConstIterator( IteratorType vector, RightOperand scalar )
215  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
216  , scalar_( scalar ) // Right hand side scalar of the multiplication expression
217  {}
218  //*******************************************************************************************
219 
220  //**Prefix increment operator****************************************************************
226  ++vector_;
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Element access operator******************************************************************
236  inline const Element operator*() const {
237  return Element( vector_->value() / scalar_, vector_->index() );
238  }
239  //*******************************************************************************************
240 
241  //**Element access operator******************************************************************
246  inline const ConstIterator* operator->() const {
247  return this;
248  }
249  //*******************************************************************************************
250 
251  //**Value function***************************************************************************
256  inline ReturnType value() const {
257  return vector_->value() / scalar_;
258  }
259  //*******************************************************************************************
260 
261  //**Index function***************************************************************************
266  inline size_t index() const {
267  return vector_->index();
268  }
269  //*******************************************************************************************
270 
271  //**Equality operator************************************************************************
277  inline bool operator==( const ConstIterator& rhs ) const {
278  return vector_ == rhs.vector_;
279  }
280  //*******************************************************************************************
281 
282  //**Inequality operator**********************************************************************
288  inline bool operator!=( const ConstIterator& rhs ) const {
289  return vector_ != rhs.vector_;
290  }
291  //*******************************************************************************************
292 
293  //**Subtraction operator*********************************************************************
299  inline DifferenceType operator-( const ConstIterator& rhs ) const {
300  return vector_ - rhs.vector_;
301  }
302  //*******************************************************************************************
303 
304  private:
305  //**Member variables*************************************************************************
308  //*******************************************************************************************
309  };
310  //**********************************************************************************************
311 
312  //**Constructor*********************************************************************************
318  explicit inline SVecScalarDivExpr( const VT& vector, ST scalar ) noexcept
319  : vector_( vector ) // Left-hand side sparse vector of the division expression
320  , scalar_( scalar ) // Right-hand side scalar of the division expression
321  {}
322  //**********************************************************************************************
323 
324  //**Subscript operator**************************************************************************
330  inline ReturnType operator[]( size_t index ) const {
331  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
332  return vector_[index] / scalar_;
333  }
334  //**********************************************************************************************
335 
336  //**At function*********************************************************************************
343  inline ReturnType at( size_t index ) const {
344  if( index >= vector_.size() ) {
345  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
346  }
347  return (*this)[index];
348  }
349  //**********************************************************************************************
350 
351  //**Begin function******************************************************************************
356  inline ConstIterator begin() const {
357  return ConstIterator( vector_.begin(), scalar_ );
358  }
359  //**********************************************************************************************
360 
361  //**End function********************************************************************************
366  inline ConstIterator end() const {
367  return ConstIterator( vector_.end(), scalar_ );
368  }
369  //**********************************************************************************************
370 
371  //**Size function*******************************************************************************
376  inline size_t size() const noexcept {
377  return vector_.size();
378  }
379  //**********************************************************************************************
380 
381  //**NonZeros function***************************************************************************
386  inline size_t nonZeros() const {
387  return vector_.nonZeros();
388  }
389  //**********************************************************************************************
390 
391  //**Find function*******************************************************************************
397  inline ConstIterator find( size_t index ) const {
399  return ConstIterator( vector_.find( index ), scalar_ );
400  }
401  //**********************************************************************************************
402 
403  //**LowerBound function*************************************************************************
409  inline ConstIterator lowerBound( size_t index ) const {
411  return ConstIterator( vector_.lowerBound( index ), scalar_ );
412  }
413  //**********************************************************************************************
414 
415  //**UpperBound function*************************************************************************
421  inline ConstIterator upperBound( size_t index ) const {
423  return ConstIterator( vector_.upperBound( index ), scalar_ );
424  }
425  //**********************************************************************************************
426 
427  //**Left operand access*************************************************************************
432  inline LeftOperand leftOperand() const noexcept {
433  return vector_;
434  }
435  //**********************************************************************************************
436 
437  //**Right operand access************************************************************************
442  inline RightOperand rightOperand() const noexcept {
443  return scalar_;
444  }
445  //**********************************************************************************************
446 
447  //**********************************************************************************************
453  template< typename T >
454  inline bool canAlias( const T* alias ) const noexcept {
455  return vector_.canAlias( alias );
456  }
457  //**********************************************************************************************
458 
459  //**********************************************************************************************
465  template< typename T >
466  inline bool isAliased( const T* alias ) const noexcept {
467  return vector_.isAliased( alias );
468  }
469  //**********************************************************************************************
470 
471  private:
472  //**Member variables****************************************************************************
475  //**********************************************************************************************
476 
477  //**Assignment to dense vectors*****************************************************************
491  template< typename VT2 > // Type of the target dense vector
492  friend inline auto assign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
494  {
496 
497  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
498 
499  assign( ~lhs, rhs.vector_ );
500  (~lhs) /= rhs.scalar_;
501  }
503  //**********************************************************************************************
504 
505  //**Assignment to sparse vectors****************************************************************
519  template< typename VT2 > // Type of the target sparse vector
520  friend inline auto assign( SparseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
522  {
524 
525  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
526 
527  assign( ~lhs, rhs.vector_ );
528  (~lhs) /= rhs.scalar_;
529  }
531  //**********************************************************************************************
532 
533  //**Addition assignment to dense vectors********************************************************
547  template< typename VT2 > // Type of the target dense vector
548  friend inline auto addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
549  -> EnableIf_t< UseAssign_v<VT2> >
550  {
552 
556 
557  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
558 
559  const ResultType tmp( serial( rhs ) );
560  addAssign( ~lhs, tmp );
561  }
563  //**********************************************************************************************
564 
565  //**Addition assignment to sparse vectors*******************************************************
566  // No special implementation for the addition assignment to sparse vectors.
567  //**********************************************************************************************
568 
569  //**Subtraction assignment to dense vectors*****************************************************
583  template< typename VT2 > // Type of the target dense vector
584  friend inline auto subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
585  -> EnableIf_t< UseAssign_v<VT2> >
586  {
588 
592 
593  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
594 
595  const ResultType tmp( serial( rhs ) );
596  subAssign( ~lhs, tmp );
597  }
599  //**********************************************************************************************
600 
601  //**Subtraction assignment to sparse vectors****************************************************
602  // No special implementation for the subtraction assignment to sparse vectors.
603  //**********************************************************************************************
604 
605  //**Multiplication assignment to dense vectors**************************************************
619  template< typename VT2 > // Type of the target dense vector
620  friend inline auto multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
621  -> EnableIf_t< UseAssign_v<VT2> >
622  {
624 
628 
629  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
630 
631  const ResultType tmp( serial( rhs ) );
632  multAssign( ~lhs, tmp );
633  }
635  //**********************************************************************************************
636 
637  //**Multiplication assignment to sparse vectors*************************************************
638  // No special implementation for the multiplication assignment to sparse vectors.
639  //**********************************************************************************************
640 
641  //**SMP assignment to dense vectors*************************************************************
642  // No special implementation for the SMP assignment to dense vectors.
643  //**********************************************************************************************
644 
645  //**SMP assignment to sparse vectors************************************************************
646  // No special implementation for the SMP assignment to sparse vectors.
647  //**********************************************************************************************
648 
649  //**SMP addition assignment to dense vectors****************************************************
663  template< typename VT2 > // Type of the target dense vector
664  friend inline auto smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
665  -> EnableIf_t< UseSMPAssign_v<VT2> >
666  {
668 
672 
673  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
674 
675  const ResultType tmp( rhs );
676  smpAddAssign( ~lhs, tmp );
677  }
679  //**********************************************************************************************
680 
681  //**SMP addition assignment to sparse vectors***************************************************
682  // No special implementation for the SMP addition assignment to sparse vectors.
683  //**********************************************************************************************
684 
685  //**SMP subtraction assignment to dense vectors*************************************************
699  template< typename VT2 > // Type of the target dense vector
700  friend inline auto smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
701  -> EnableIf_t< UseSMPAssign_v<VT2> >
702  {
704 
708 
709  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
710 
711  const ResultType tmp( rhs );
712  smpSubAssign( ~lhs, tmp );
713  }
715  //**********************************************************************************************
716 
717  //**SMP subtraction assignment to sparse vectors************************************************
718  // No special implementation for the SMP subtraction assignment to sparse vectors.
719  //**********************************************************************************************
720 
721  //**SMP multiplication assignment to dense vectors**********************************************
735  template< typename VT2 > // Type of the target dense vector
736  friend inline auto smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
737  -> EnableIf_t< UseSMPAssign_v<VT2> >
738  {
740 
744 
745  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
746 
747  const ResultType tmp( rhs );
748  smpMultAssign( ~lhs, tmp );
749  }
751  //**********************************************************************************************
752 
753  //**SMP multiplication assignment to sparse vectors*********************************************
754  // No special implementation for the SMP multiplication assignment to sparse vectors.
755  //**********************************************************************************************
756 
757  //**Compile time checks*************************************************************************
767  //**********************************************************************************************
768 };
769 //*************************************************************************************************
770 
771 
772 
773 
774 //=================================================================================================
775 //
776 // GLOBAL BINARY ARITHMETIC OPERATORS
777 //
778 //=================================================================================================
779 
780 //*************************************************************************************************
785 template< typename VT // Type of the left-hand side sparse vector
786  , typename ST // Type of the right-hand side scalar
787  , bool TF > // Transpose flag
788 struct SVecScalarDivExprHelper
789 {
790  private:
791  //**********************************************************************************************
792  using ScalarType = If_t< IsFloatingPoint_v< UnderlyingBuiltin_t<VT> > ||
793  IsFloatingPoint_v< UnderlyingBuiltin_t<ST> >
794  , If_t< IsComplex_v< UnderlyingNumeric_t<VT> > && IsBuiltin_v<ST>
795  , DivTrait_t< UnderlyingBuiltin_t<VT>, ST >
796  , DivTrait_t< UnderlyingNumeric_t<VT>, ST > >
797  , ST >;
798  //**********************************************************************************************
799 
800  public:
801  //**********************************************************************************************
802  using Type = If_t< IsInvertible_v<ScalarType>
803  , SVecScalarMultExpr<VT,ScalarType,TF>
804  , SVecScalarDivExpr<VT,ScalarType,TF> >;
805  //**********************************************************************************************
806 };
808 //*************************************************************************************************
809 
810 
811 //*************************************************************************************************
824 template< typename VT // Type of the left-hand side sparse vector
825  , bool TF // Transpose flag of the left-hand side sparse vector
826  , typename ST // Type of the right-hand side scalar
827  , DisableIf_t< IsZero_v<VT> >* = nullptr >
828 inline const typename SVecScalarDivExprHelper<VT,ST,TF>::Type
829  svecscalardiv( const SparseVector<VT,TF>& vec, ST scalar )
830 {
832 
833  using ReturnType = typename SVecScalarDivExprHelper<VT,ST,TF>::Type;
834  using ScalarType = RightOperand_t<ReturnType>;
835 
836  if( IsMultExpr_v<ReturnType> ) {
837  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
838  }
839  else {
840  return ReturnType( ~vec, scalar );
841  }
842 }
844 //*************************************************************************************************
845 
846 
847 //*************************************************************************************************
860 template< typename VT // Type of the left-hand side sparse vector
861  , bool TF // Transpose flag of the left-hand side sparse vector
862  , typename ST // Type of the right-hand side scalar
863  , EnableIf_t< IsZero_v<VT> >* = nullptr >
864 inline decltype(auto)
865  svecscalardiv( const SparseVector<VT,TF>& vec, ST scalar )
866 {
868 
869  MAYBE_UNUSED( scalar );
870 
871  using ReturnType = const DivTrait_t< ResultType_t<VT>, ST >;
872 
875 
876  return ReturnType( (~vec).size() );
877 }
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
905 template< typename VT // Type of the left-hand side sparse vector
906  , typename ST // Type of the right-hand side scalar
907  , bool TF // Transpose flag
908  , EnableIf_t< IsNumeric_v<ST> >* = nullptr >
909 inline decltype(auto) operator/( const SparseVector<VT,TF>& vec, ST scalar )
910 {
912 
913  BLAZE_USER_ASSERT( scalar != ST(0), "Division by zero detected" );
914 
915  return svecscalardiv( ~vec, scalar );
916 }
917 //*************************************************************************************************
918 
919 
920 
921 
922 //=================================================================================================
923 //
924 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
925 //
926 //=================================================================================================
927 
928 //*************************************************************************************************
941 template< typename VT // Type of the sparse vector of the left-hand side expression
942  , typename ST1 // Type of the scalar of the left-hand side expression
943  , bool TF // Transpose flag of the sparse vector
944  , typename ST2 // Type of the right-hand side scalar
945  , EnableIf_t< IsNumeric_v<ST2> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
946 inline decltype(auto) operator*( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
947 {
949 
950  return vec.leftOperand() * ( scalar / vec.rightOperand() );
951 }
953 //*************************************************************************************************
954 
955 
956 //*************************************************************************************************
969 template< typename ST1 // Type of the left-hand side scalar
970  , typename VT // Type of the sparse vector of the right-hand side expression
971  , typename ST2 // Type of the scalar of the right-hand side expression
972  , bool TF // Transpose flag of the sparse vector
973  , EnableIf_t< IsNumeric_v<ST1> && ( IsInvertible_v<ST1> || IsInvertible_v<ST2> ) >* = nullptr >
974 inline decltype(auto) operator*( ST1 scalar, const SVecScalarDivExpr<VT,ST2,TF>& vec )
975 {
977 
978  return vec.leftOperand() * ( scalar / vec.rightOperand() );
979 }
981 //*************************************************************************************************
982 
983 
984 //*************************************************************************************************
997 template< typename VT // Type of the sparse vector of the left-hand side expression
998  , typename ST1 // Type of the scalar of the left-hand side expression
999  , bool TF // Transpose flag of the sparse vector
1000  , typename ST2 // Type of the right-hand side scalar
1001  , EnableIf_t< IsNumeric_v<ST2> >* = nullptr >
1002 inline decltype(auto) operator/( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
1003 {
1005 
1006  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
1007 
1008  using MultType = MultTrait_t<ST1,ST2>;
1009  using ReturnType = typename SVecScalarDivExprHelper<VT,MultType,TF>::Type;
1010  using ScalarType = RightOperand_t<ReturnType>;
1011 
1012  if( IsMultExpr_v<ReturnType> ) {
1013  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
1014  }
1015  else {
1016  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
1017  }
1018 }
1020 //*************************************************************************************************
1021 
1022 } // namespace blaze
1023 
1024 #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:214
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecScalarDivExpr.h:376
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
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 template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecScalarDivExpr.h:181
ResultType_t< VT > RT
Result type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:109
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:266
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:366
Header file for the MAYBE_UNUSED function template.
DivTrait_t< RT, ST > ResultType
Result type for expression template evaluations.
Definition: SVecScalarDivExpr.h:162
Header file for the Computation base class.
Header file for the RequiresEvaluation type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarDivExpr.h:204
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:192
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:246
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:176
SVecScalarDivExpr(const VT &vector, ST scalar) noexcept
Constructor for the SVecScalarDivExpr class.
Definition: SVecScalarDivExpr.h:318
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarDivExpr.h:299
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:164
RightOperand scalar_
Right hand side scalar of the multiplication expression.
Definition: SVecScalarDivExpr.h:307
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecScalarDivExpr.h:421
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecScalarDivExpr.h:201
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:198
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:306
#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:187
#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 operator *() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:236
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#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:199
Constraint on the data type.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarDivExpr.h:256
ValueType & ReferenceType
Reference return type.
Definition: SVecScalarDivExpr.h:200
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarDivExpr.h:466
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:124
Constraint on the data type.
If_t< useAssign, const ResultType, const SVecScalarDivExpr & > CompositeType
Data type for composite expression templates.
Definition: SVecScalarDivExpr.h:170
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarDivExpr.h:225
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:386
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecScalarDivExpr.h:397
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SVecScalarDivExpr.h:474
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:135
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecScalarDivExpr.h:167
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarDivExpr.h:454
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:356
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarDivExpr.h:197
RightOperand rightOperand() const noexcept
Returns the right-hand side scalar operand.
Definition: SVecScalarDivExpr.h:442
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:110
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:173
#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
Header file for all forward declarations for expression class templates.
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:195
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecScalarDivExpr.h:432
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:156
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarDivExpr.h:163
LeftOperand vector_
Left-hand side sparse vector of the division expression.
Definition: SVecScalarDivExpr.h:473
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
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecScalarDivExpr.h:409
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:277
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:146
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecScalarDivExpr.h:343
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SVecScalarDivExpr.h:121
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:288
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:330
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
CompositeType_t< VT > CT
Composite type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:111
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.