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>
68 #include <blaze/util/Assert.h>
73 #include <blaze/util/EnableIf.h>
74 #include <blaze/util/Exception.h>
75 #include <blaze/util/InvalidType.h>
77 #include <blaze/util/mpl/And.h>
78 #include <blaze/util/SelectType.h>
79 #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 : public SparseVector< SVecScalarDivExpr<VT,ST,TF>, TF >
103  , private VecScalarDivExpr
104  , private Computation
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename VT::ResultType RT;
109  typedef typename VT::ReturnType RN;
110  typedef typename VT::CompositeType CT;
111  //**********************************************************************************************
112 
113  //**Return type evaluation**********************************************************************
115 
120  enum { returnExpr = !IsTemporary<RN>::value };
121 
124  //**********************************************************************************************
125 
126  //**Serial evaluation strategy******************************************************************
128 
134  enum { useAssign = RequiresEvaluation<VT>::value };
135 
137  template< typename VT2 >
139  struct UseAssign {
140  enum { value = useAssign };
141  };
143  //**********************************************************************************************
144 
145  //**Parallel evaluation strategy****************************************************************
147 
153  template< typename VT2 >
154  struct UseSMPAssign {
155  enum { value = ( !VT2::smpAssignable || !VT::smpAssignable ) && useAssign };
156  };
158  //**********************************************************************************************
159 
160  public:
161  //**Type definitions****************************************************************************
166 
169 
172 
174  typedef typename SelectType< IsExpression<VT>::value, const VT, const VT& >::Type LeftOperand;
175 
177  typedef ST RightOperand;
178  //**********************************************************************************************
179 
180  //**Compilation flags***************************************************************************
182  enum { smpAssignable = 0 };
183  //**********************************************************************************************
184 
185  //**ConstIterator class definition**************************************************************
189  {
190  public:
191  //**Type definitions*************************************************************************
194 
197 
198  typedef std::forward_iterator_tag IteratorCategory;
199  typedef Element ValueType;
200  typedef ValueType* PointerType;
201  typedef ValueType& ReferenceType;
203 
204  // STL iterator requirements
205  typedef IteratorCategory iterator_category;
206  typedef ValueType value_type;
207  typedef PointerType pointer;
208  typedef ReferenceType reference;
209  typedef DifferenceType difference_type;
210  //*******************************************************************************************
211 
212  //**Constructor******************************************************************************
215  inline ConstIterator( IteratorType vector, RightOperand scalar )
216  : vector_( vector ) // Iterator over the elements of the left-hand side sparse vector expression
217  , scalar_( scalar ) // Right hand side scalar of the multiplication expression
218  {}
219  //*******************************************************************************************
220 
221  //**Prefix increment operator****************************************************************
227  ++vector_;
228  return *this;
229  }
230  //*******************************************************************************************
231 
232  //**Element access operator******************************************************************
237  inline const Element operator*() const {
238  return Element( vector_->value() / scalar_, vector_->index() );
239  }
240  //*******************************************************************************************
241 
242  //**Element access operator******************************************************************
247  inline const ConstIterator* operator->() const {
248  return this;
249  }
250  //*******************************************************************************************
251 
252  //**Value function***************************************************************************
257  inline ReturnType value() const {
258  return vector_->value() / scalar_;
259  }
260  //*******************************************************************************************
261 
262  //**Index function***************************************************************************
267  inline size_t index() const {
268  return vector_->index();
269  }
270  //*******************************************************************************************
271 
272  //**Equality operator************************************************************************
278  inline bool operator==( const ConstIterator& rhs ) const {
279  return vector_ == rhs.vector_;
280  }
281  //*******************************************************************************************
282 
283  //**Inequality operator**********************************************************************
289  inline bool operator!=( const ConstIterator& rhs ) const {
290  return vector_ != rhs.vector_;
291  }
292  //*******************************************************************************************
293 
294  //**Subtraction operator*********************************************************************
300  inline DifferenceType operator-( const ConstIterator& rhs ) const {
301  return vector_ - rhs.vector_;
302  }
303  //*******************************************************************************************
304 
305  private:
306  //**Member variables*************************************************************************
307  IteratorType vector_;
308  RightOperand scalar_;
309  //*******************************************************************************************
310  };
311  //**********************************************************************************************
312 
313  //**Constructor*********************************************************************************
319  explicit inline SVecScalarDivExpr( const VT& vector, ST scalar )
320  : vector_( vector ) // Left-hand side sparse vector of the division expression
321  , scalar_( scalar ) // Right-hand side scalar of the division expression
322  {}
323  //**********************************************************************************************
324 
325  //**Subscript operator**************************************************************************
331  inline ReturnType operator[]( size_t index ) const {
332  BLAZE_INTERNAL_ASSERT( index < vector_.size(), "Invalid vector access index" );
333  return vector_[index] / scalar_;
334  }
335  //**********************************************************************************************
336 
337  //**At function*********************************************************************************
344  inline ReturnType at( size_t index ) const {
345  if( index >= vector_.size() ) {
346  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
347  }
348  return (*this)[index];
349  }
350  //**********************************************************************************************
351 
352  //**Begin function******************************************************************************
357  inline ConstIterator begin() const {
358  return ConstIterator( vector_.begin(), scalar_ );
359  }
360  //**********************************************************************************************
361 
362  //**End function********************************************************************************
367  inline ConstIterator end() const {
368  return ConstIterator( vector_.end(), scalar_ );
369  }
370  //**********************************************************************************************
371 
372  //**Size function*******************************************************************************
377  inline size_t size() const {
378  return vector_.size();
379  }
380  //**********************************************************************************************
381 
382  //**NonZeros function***************************************************************************
387  inline size_t nonZeros() const {
388  return vector_.nonZeros();
389  }
390  //**********************************************************************************************
391 
392  //**Find function*******************************************************************************
398  inline ConstIterator find( size_t index ) const {
400  return ConstIterator( vector_.find( index ), scalar_ );
401  }
402  //**********************************************************************************************
403 
404  //**LowerBound function*************************************************************************
410  inline ConstIterator lowerBound( size_t index ) const {
412  return ConstIterator( vector_.lowerBound( index ), scalar_ );
413  }
414  //**********************************************************************************************
415 
416  //**UpperBound function*************************************************************************
422  inline ConstIterator upperBound( size_t index ) const {
424  return ConstIterator( vector_.upperBound( index ), scalar_ );
425  }
426  //**********************************************************************************************
427 
428  //**Left operand access*************************************************************************
433  inline LeftOperand leftOperand() const {
434  return vector_;
435  }
436  //**********************************************************************************************
437 
438  //**Right operand access************************************************************************
443  inline RightOperand rightOperand() const {
444  return scalar_;
445  }
446  //**********************************************************************************************
447 
448  //**********************************************************************************************
454  template< typename T >
455  inline bool canAlias( const T* alias ) const {
456  return vector_.canAlias( alias );
457  }
458  //**********************************************************************************************
459 
460  //**********************************************************************************************
466  template< typename T >
467  inline bool isAliased( const T* alias ) const {
468  return vector_.isAliased( alias );
469  }
470  //**********************************************************************************************
471 
472  private:
473  //**Member variables****************************************************************************
474  LeftOperand vector_;
475  RightOperand scalar_;
476  //**********************************************************************************************
477 
478  //**Assignment to dense vectors*****************************************************************
492  template< typename VT2 > // Type of the target dense vector
493  friend inline typename EnableIf< UseAssign<VT2> >::Type
494  assign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
495  {
497 
498  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
499 
500  assign( ~lhs, rhs.vector_ );
501  (~lhs) /= rhs.scalar_;
502  }
504  //**********************************************************************************************
505 
506  //**Assignment to sparse vectors****************************************************************
520  template< typename VT2 > // Type of the target sparse vector
521  friend inline typename EnableIf< UseAssign<VT2> >::Type
522  assign( SparseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
523  {
525 
526  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
527 
528  assign( ~lhs, rhs.vector_ );
529  (~lhs) /= rhs.scalar_;
530  }
532  //**********************************************************************************************
533 
534  //**Addition assignment to dense vectors********************************************************
548  template< typename VT2 > // Type of the target dense vector
549  friend inline typename EnableIf< UseAssign<VT2> >::Type
550  addAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
551  {
553 
557 
558  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
559 
560  const ResultType tmp( serial( rhs ) );
561  addAssign( ~lhs, tmp );
562  }
564  //**********************************************************************************************
565 
566  //**Addition assignment to sparse vectors*******************************************************
567  // No special implementation for the addition assignment to sparse vectors.
568  //**********************************************************************************************
569 
570  //**Subtraction assignment to dense vectors*****************************************************
584  template< typename VT2 > // Type of the target dense vector
585  friend inline typename EnableIf< UseAssign<VT2> >::Type
586  subAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
587  {
589 
593 
594  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
595 
596  const ResultType tmp( serial( rhs ) );
597  subAssign( ~lhs, tmp );
598  }
600  //**********************************************************************************************
601 
602  //**Subtraction assignment to sparse vectors****************************************************
603  // No special implementation for the subtraction assignment to sparse vectors.
604  //**********************************************************************************************
605 
606  //**Multiplication assignment to dense vectors**************************************************
620  template< typename VT2 > // Type of the target dense vector
621  friend inline typename EnableIf< UseAssign<VT2> >::Type
622  multAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
623  {
625 
629 
630  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
631 
632  const ResultType tmp( serial( rhs ) );
633  multAssign( ~lhs, tmp );
634  }
636  //**********************************************************************************************
637 
638  //**Multiplication assignment to sparse vectors*************************************************
639  // No special implementation for the multiplication assignment to sparse vectors.
640  //**********************************************************************************************
641 
642  //**SMP assignment to dense vectors*************************************************************
643  // No special implementation for the SMP assignment to dense vectors.
644  //**********************************************************************************************
645 
646  //**SMP assignment to sparse vectors************************************************************
647  // No special implementation for the SMP assignment to sparse vectors.
648  //**********************************************************************************************
649 
650  //**SMP addition assignment to dense vectors****************************************************
664  template< typename VT2 > // Type of the target dense vector
665  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
666  smpAddAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
667  {
669 
673 
674  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
675 
676  const ResultType tmp( rhs );
677  smpAddAssign( ~lhs, tmp );
678  }
680  //**********************************************************************************************
681 
682  //**SMP addition assignment to sparse vectors***************************************************
683  // No special implementation for the SMP addition assignment to sparse vectors.
684  //**********************************************************************************************
685 
686  //**SMP subtraction assignment to dense vectors*************************************************
700  template< typename VT2 > // Type of the target dense vector
701  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
702  smpSubAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
703  {
705 
709 
710  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
711 
712  const ResultType tmp( rhs );
713  smpSubAssign( ~lhs, tmp );
714  }
716  //**********************************************************************************************
717 
718  //**SMP subtraction assignment to sparse vectors************************************************
719  // No special implementation for the SMP subtraction assignment to sparse vectors.
720  //**********************************************************************************************
721 
722  //**SMP multiplication assignment to dense vectors**********************************************
736  template< typename VT2 > // Type of the target dense vector
737  friend inline typename EnableIf< UseSMPAssign<VT2> >::Type
738  smpMultAssign( DenseVector<VT2,TF>& lhs, const SVecScalarDivExpr& rhs )
739  {
741 
745 
746  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
747 
748  const ResultType tmp( rhs );
749  smpMultAssign( ~lhs, tmp );
750  }
752  //**********************************************************************************************
753 
754  //**SMP multiplication assignment to sparse vectors*********************************************
755  // No special implementation for the SMP multiplication assignment to sparse vectors.
756  //**********************************************************************************************
757 
758  //**Compile time checks*************************************************************************
765  BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ST, RightOperand );
767  //**********************************************************************************************
768 };
769 //*************************************************************************************************
770 
771 
772 
773 
774 //=================================================================================================
775 //
776 // GLOBAL BINARY ARITHMETIC OPERATORS
777 //
778 //=================================================================================================
779 
780 //*************************************************************************************************
803 template< typename T1 // Type of the left-hand side sparse vector
804  , typename T2 // Type of the right-hand side scalar
805  , bool TF > // Transpose flag
806 inline const typename EnableIf< IsNumeric<T2>, typename DivExprTrait<T1,T2>::Type >::Type
807  operator/( const SparseVector<T1,TF>& vec, T2 scalar )
808 {
810 
811  BLAZE_USER_ASSERT( scalar != T2(0), "Division by zero detected" );
812 
813  typedef typename DivExprTrait<T1,T2>::Type ReturnType;
814  typedef typename ReturnType::RightOperand ScalarType;
815 
817  return ReturnType( ~vec, ScalarType(1)/ScalarType(scalar) );
818  }
819  else {
820  return ReturnType( ~vec, scalar );
821  }
822 }
823 //*************************************************************************************************
824 
825 
826 
827 
828 //=================================================================================================
829 //
830 // GLOBAL RESTRUCTURING BINARY ARITHMETIC OPERATORS
831 //
832 //=================================================================================================
833 
834 //*************************************************************************************************
847 template< typename VT // Type of the sparse vector of the left-hand side expression
848  , typename ST1 // Type of the scalar of the left-hand side expression
849  , bool TF // Transpose flag of the sparse vector
850  , typename ST2 > // Type of the right-hand side scalar
851 inline const typename EnableIf< And< IsNumeric<ST2>, IsInvertible<typename DivTrait<ST2,ST1>::Type > >
852  , typename MultExprTrait< SVecScalarDivExpr<VT,ST1,TF>, ST2 >::Type >::Type
853  operator*( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
854 {
856 
857  return vec.leftOperand() * ( scalar / vec.rightOperand() );
858 }
860 //*************************************************************************************************
861 
862 
863 //*************************************************************************************************
876 template< typename ST1 // Type of the left-hand side scalar
877  , typename VT // Type of the sparse vector of the right-hand side expression
878  , typename ST2 // Type of the scalar of the right-hand side expression
879  , bool TF > // Transpose flag of the sparse vector
880 inline const typename EnableIf< And< IsNumeric<ST1>, IsInvertible< typename DivTrait<ST1,ST2>::Type > >
881  , typename MultExprTrait< ST1, SVecScalarDivExpr<VT,ST2,TF> >::Type >::Type
882  operator*( ST1 scalar, const SVecScalarDivExpr<VT,ST2,TF>& vec )
883 {
885 
886  return vec.leftOperand() * ( scalar / vec.rightOperand() );
887 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
905 template< typename VT // Type of the sparse vector of the left-hand side expression
906  , typename ST1 // Type of the scalar of the left-hand side expression
907  , bool TF // Transpose flag of the sparse vector
908  , typename ST2 > // Type of the right-hand side scalar
909 inline const typename EnableIf< IsNumeric<ST2>
910  , typename DivExprTrait<VT,typename MultTrait<ST1,ST2>::Type>::Type >::Type
911  operator/( const SVecScalarDivExpr<VT,ST1,TF>& vec, ST2 scalar )
912 {
914 
915  BLAZE_USER_ASSERT( scalar != ST2(0), "Division by zero detected" );
916 
917  typedef typename MultTrait<ST1,ST2>::Type MultType;
918  typedef typename DivExprTrait<VT,MultType>::Type ReturnType;
919  typedef typename ReturnType::RightOperand ScalarType;
920 
921  if( IsMultExpr<ReturnType>::value ) {
922  return ReturnType( vec.leftOperand(), ScalarType(1)/( vec.rightOperand() * scalar ) );
923  }
924  else {
925  return ReturnType( vec.leftOperand(), vec.rightOperand() * scalar );
926  }
927 }
929 //*************************************************************************************************
930 
931 
932 
933 
934 //=================================================================================================
935 //
936 // SIZE SPECIALIZATIONS
937 //
938 //=================================================================================================
939 
940 //*************************************************************************************************
942 template< typename VT, typename ST, bool TF >
943 struct Size< SVecScalarDivExpr<VT,ST,TF> > : public Size<VT>
944 {};
946 //*************************************************************************************************
947 
948 
949 
950 
951 //=================================================================================================
952 //
953 // SVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
954 //
955 //=================================================================================================
956 
957 //*************************************************************************************************
959 template< typename VT, typename ST1, typename ST2 >
960 struct SVecScalarMultExprTrait< SVecScalarDivExpr<VT,ST1,false>, ST2 >
961 {
962  private:
963  //**********************************************************************************************
964  typedef typename DivTrait<ST2,ST1>::Type ScalarType;
965  //**********************************************************************************************
966 
967  //**********************************************************************************************
968  enum { condition = IsInvertible<ScalarType>::value };
969  //**********************************************************************************************
970 
971  //**********************************************************************************************
972  typedef typename SVecScalarMultExprTrait<VT,ScalarType>::Type T1;
973  typedef SVecScalarMultExpr< SVecScalarDivExpr<VT,ST1,false>, ST2, false > T2;
974  //**********************************************************************************************
975 
976  public:
977  //**********************************************************************************************
978  typedef typename SelectType< IsSparseVector<VT>::value && IsColumnVector<VT>::value &&
979  IsNumeric<ST1>::value && IsNumeric<ST2>::value
980  , typename SelectType<condition,T1,T2>::Type
981  , INVALID_TYPE >::Type Type;
982  //**********************************************************************************************
983 };
985 //*************************************************************************************************
986 
987 
988 
989 
990 //=================================================================================================
991 //
992 // TSVECSCALARMULTEXPRTRAIT SPECIALIZATIONS
993 //
994 //=================================================================================================
995 
996 //*************************************************************************************************
998 template< typename VT, typename ST1, typename ST2 >
999 struct TSVecScalarMultExprTrait< SVecScalarDivExpr<VT,ST1,true>, ST2 >
1000 {
1001  private:
1002  //**********************************************************************************************
1003  typedef typename DivTrait<ST2,ST1>::Type ScalarType;
1004  //**********************************************************************************************
1005 
1006  //**********************************************************************************************
1007  enum { condition = IsInvertible<ScalarType>::value };
1008  //**********************************************************************************************
1009 
1010  //**********************************************************************************************
1011  typedef typename SVecScalarMultExprTrait<VT,ScalarType>::Type T1;
1012  typedef SVecScalarMultExpr< SVecScalarDivExpr<VT,ST1,true>, ST2, true > T2;
1013  //**********************************************************************************************
1014 
1015  public:
1016  //**********************************************************************************************
1017  typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
1018  IsNumeric<ST1>::value && IsNumeric<ST2>::value
1019  , typename SelectType<condition,T1,T2>::Type
1020  , INVALID_TYPE >::Type Type;
1021  //**********************************************************************************************
1022 };
1024 //*************************************************************************************************
1025 
1026 
1027 
1028 
1029 //=================================================================================================
1030 //
1031 // SUBVECTOREXPRTRAIT SPECIALIZATIONS
1032 //
1033 //=================================================================================================
1034 
1035 //*************************************************************************************************
1037 template< typename VT, typename ST, bool TF, bool AF >
1038 struct SubvectorExprTrait< SVecScalarDivExpr<VT,ST,TF>, AF >
1039 {
1040  public:
1041  //**********************************************************************************************
1042  typedef typename DivExprTrait< typename SubvectorExprTrait<const VT,AF>::Type, ST >::Type Type;
1043  //**********************************************************************************************
1044 };
1046 //*************************************************************************************************
1047 
1048 } // namespace blaze
1049 
1050 #endif
Pointer difference type of the Blaze library.
Data type constraint.
Constraint on the data type.
ConstIterator(IteratorType vector, RightOperand scalar)
Constructor for the ConstIterator class.
Definition: SVecScalarDivExpr.h:215
VT::ReturnType RN
Return type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:109
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:278
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7820
const EnableIf< IsNumeric< T2 >, typename DivExprTrait< T1, T2 >::Type >::Type operator/(const DenseMatrix< T1, SO > &mat, T2 scalar)
Division operator for the division of a dense matrix by a scalar value ( ).
Definition: DMatScalarDivExpr.h:962
Header file for basic type definitions.
Header file for the SparseVector base class.
Compile time check whether the given type is a multiplication expression template.This type trait class tests whether or not the given type Type is a multiplication expression template (i.e. an expression representing an element-wise vector multiplication, a matrix/vector multiplication, a vector/matrix multiplication, or a matrix multiplication). In order to qualify as a valid multiplication expression template, the given type has to derive (publicly or privately) from the MultExpr base class. In case the given type is a valid multiplication expression template, the value member enumeration is set to 1, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to 0, Type is FalseType, and the class derives from FalseType.
Definition: IsMultExpr.h:90
ConstIterator upperBound(size_t index) const
Returns an iterator to the first index greater then the given index.
Definition: SVecScalarDivExpr.h:422
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SVecScalarDivExpr.h:202
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ConstIterator begin() const
Returns an iterator to the first non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:357
ValueIndexPair< ElementType > Element
Element type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:193
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecScalarDivExpr.h:455
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Header file for the IsRowVector type trait.
Header file for the VecScalarDivExpr base class.
DivTrait< RT, ST >::Type ResultType
Result type for expression template evaluations.
Definition: SVecScalarDivExpr.h:163
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecScalarDivExpr.h:165
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
Header file for the And class template.
SVecScalarDivExpr(const VT &vector, ST scalar)
Constructor for the SVecScalarDivExpr class.
Definition: SVecScalarDivExpr.h:319
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
DifferenceType difference_type
Difference between two iterators.
Definition: SVecScalarDivExpr.h:209
ValueType * PointerType
Pointer return type.
Definition: SVecScalarDivExpr.h:200
Header file for the RequiresEvaluation type trait.
PointerType pointer
Pointer return type.
Definition: SVecScalarDivExpr.h:207
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecScalarDivExpr.h:387
Constraint on the data type.
Header file for the DivExprTrait class template.
ReferenceType reference
Reference return type.
Definition: SVecScalarDivExpr.h:208
Evaluation of the resulting expression type of a division.Via this type trait it is possible to evalu...
Definition: DivExprTrait.h:88
Header file for the MultExprTrait class template.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
RightOperand scalar_
Right hand side scalar of the multiplication expression.
Definition: SVecScalarDivExpr.h:308
VT::CompositeType CT
Composite type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:110
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
RightOperand rightOperand() const
Returns the right-hand side scalar operand.
Definition: SVecScalarDivExpr.h:443
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: SVecScalarDivExpr.h:433
Header file for the ValueIndexPair class.
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
SelectType< IsExpression< VT >::value, const VT, const VT & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:174
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SVecScalarDivExpr.h:289
IteratorType vector_
Iterator over the elements of the left-hand side sparse vector expression.
Definition: SVecScalarDivExpr.h:307
Header file for the IsMultExpr type trait class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
SelectType< useAssign, const ResultType, const SVecScalarDivExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SVecScalarDivExpr.h:171
RemoveReference< LeftOperand >::Type::ConstIterator IteratorType
Iterator type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:196
DivExprTrait< RN, ST >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecScalarDivExpr.h:123
Iterator over the elements of the sparse vector/scalar multiplication expression. ...
Definition: SVecScalarDivExpr.h:188
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SVecScalarDivExpr.h:300
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SVecScalarDivExpr.h:198
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE(A, B)
Data type constraint.In case the two types A and B are not the same (ignoring all cv-qualifiers of bo...
Definition: SameType.h:89
#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:79
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:78
Constraint on the data type.
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
ConstIterator & operator++()
Pre-increment operator.
Definition: SVecScalarDivExpr.h:226
Constraint on the data type.
Header file for the EnableIf class template.
ConstIterator lowerBound(size_t index) const
Returns an iterator to the first index not less then the given index.
Definition: SVecScalarDivExpr.h:410
Header file for the serial shim.
RightOperand scalar_
Right-hand side scalar of the division expression.
Definition: SVecScalarDivExpr.h:475
ST RightOperand
Composite type of the right-hand side scalar value.
Definition: SVecScalarDivExpr.h:177
ReturnType value() const
Access to the current value of the sparse element.
Definition: SVecScalarDivExpr.h:257
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecScalarDivExpr.h:168
Header file for the IsNumeric type trait.
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecScalarDivExpr.h:344
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for run time assertion macros.
Utility type for generic codes.
Header file for the division trait.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecScalarDivExpr.h:377
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecScalarDivExpr.h:467
ValueType & ReferenceType
Reference return type.
Definition: SVecScalarDivExpr.h:201
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Expression object for divisions of a sparse vector by a scalar.The SVecScalarDivExpr class represents...
Definition: Forward.h:127
LeftOperand vector_
Left-hand side sparse vector of the division expression.
Definition: SVecScalarDivExpr.h:474
Element ValueType
Type of the underlying pointers.
Definition: SVecScalarDivExpr.h:199
Header file for the RemoveReference type trait.
Header file for the IsInvertible type trait.
Base template for the DivTrait class.
Definition: DivTrait.h:138
#define BLAZE_CONSTRAINT_MUST_NOT_BE_FLOATING_POINT_TYPE(T)
Constraint on the data type.In case the given data type T is a floating point data type...
Definition: FloatingPoint.h:118
const Element operator*() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:237
size_t index() const
Access to the current index of the sparse element.
Definition: SVecScalarDivExpr.h:267
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Header file for the IsComputation type trait class.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecScalarDivExpr.h:331
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
SVecScalarDivExpr< VT, ST, TF > This
Type of this SVecScalarDivExpr instance.
Definition: SVecScalarDivExpr.h:162
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the SubvectorExprTrait class template.
VT::ResultType RT
Result type of the sparse vector expression.
Definition: SVecScalarDivExpr.h:108
Header file for exception macros.
Header file for the IsColumnVector type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SVecScalarDivExpr.h:205
const ConstIterator * operator->() const
Direct access to the sparse vector element at the current iterator position.
Definition: SVecScalarDivExpr.h:247
EnableIf< IsDenseVector< VT1 > >::Type 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:189
Header file for the Size type trait.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecScalarDivExpr.h:164
#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:81
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
ConstIterator end() const
Returns an iterator just past the last non-zero element of the sparse vector.
Definition: SVecScalarDivExpr.h:367
Header file for the IsExpression type trait class.
ValueType value_type
Type of the underlying pointers.
Definition: SVecScalarDivExpr.h:206
Header file for the FunctionTrace class.
ConstIterator find(size_t index) const
Searches for a specific vector element.
Definition: SVecScalarDivExpr.h:398