SVecSVecSubExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSVECSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECSVECSUBEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
47 #include <blaze/math/Exception.h>
52 #include <blaze/math/Functions.h>
63 #include <blaze/util/Assert.h>
65 #include <blaze/util/DisableIf.h>
66 #include <blaze/util/EnableIf.h>
68 #include <blaze/util/mpl/If.h>
69 #include <blaze/util/mpl/Max.h>
70 #include <blaze/util/Types.h>
72 
73 
74 namespace blaze {
75 
76 //=================================================================================================
77 //
78 // CLASS SVECSVECSUBEXPR
79 //
80 //=================================================================================================
81 
82 //*************************************************************************************************
89 template< typename VT1 // Type of the left-hand side sparse vector
90  , typename VT2 // Type of the right-hand side sparse vector
91  , bool TF > // Transpose flag
92 class SVecSVecSubExpr : public SparseVector< SVecSVecSubExpr<VT1,VT2,TF>, TF >
93  , private VecVecSubExpr
94  , private Computation
95 {
96  private:
97  //**Type definitions****************************************************************************
104  //**********************************************************************************************
105 
106  //**Return type evaluation**********************************************************************
108 
113  enum : bool { returnExpr = !IsTemporary<RN1>::value && !IsTemporary<RN2>::value };
114 
117  //**********************************************************************************************
118 
119  //**Parallel evaluation strategy****************************************************************
121 
126  template< typename VT >
127  struct UseSMPAssign {
128  enum : bool { value = VT::smpAssignable };
129  };
131  //**********************************************************************************************
132 
133  public:
134  //**Type definitions****************************************************************************
139 
142 
144  typedef const ResultType CompositeType;
145 
147  typedef If_< IsExpression<VT1>, const VT1, const VT1& > LeftOperand;
148 
150  typedef If_< IsExpression<VT2>, const VT2, const VT2& > RightOperand;
151  //**********************************************************************************************
152 
153  //**Compilation flags***************************************************************************
155  enum : bool { smpAssignable = false };
156  //**********************************************************************************************
157 
158  //**Constructor*********************************************************************************
161  explicit inline SVecSVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
162  : lhs_( lhs ) // Left-hand side sparse vector of the subtraction expression
163  , rhs_( rhs ) // Right-hand side sparse vector of the subtraction expression
164  {
165  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
166  }
167  //**********************************************************************************************
168 
169  //**Subscript operator**************************************************************************
175  inline ReturnType operator[]( size_t index ) const {
176  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
177  return lhs_[index] - rhs_[index];
178  }
179  //**********************************************************************************************
180 
181  //**At function*********************************************************************************
188  inline ReturnType at( size_t index ) const {
189  if( index >= lhs_.size() ) {
190  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
191  }
192  return (*this)[index];
193  }
194  //**********************************************************************************************
195 
196  //**Size function*******************************************************************************
201  inline size_t size() const noexcept {
202  return lhs_.size();
203  }
204  //**********************************************************************************************
205 
206  //**NonZeros function***************************************************************************
211  inline size_t nonZeros() const {
212  return min( lhs_.size(), lhs_.nonZeros() + rhs_.nonZeros() );
213  }
214  //**********************************************************************************************
215 
216  //**Left operand access*************************************************************************
221  inline LeftOperand leftOperand() const noexcept {
222  return lhs_;
223  }
224  //**********************************************************************************************
225 
226  //**Right operand access************************************************************************
231  inline RightOperand rightOperand() const noexcept {
232  return rhs_;
233  }
234  //**********************************************************************************************
235 
236  //**********************************************************************************************
242  template< typename T >
243  inline bool canAlias( const T* alias ) const noexcept {
244  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
245  }
246  //**********************************************************************************************
247 
248  //**********************************************************************************************
254  template< typename T >
255  inline bool isAliased( const T* alias ) const noexcept {
256  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
257  }
258  //**********************************************************************************************
259 
260  private:
261  //**Member variables****************************************************************************
262  LeftOperand lhs_;
263  RightOperand rhs_;
264  //**********************************************************************************************
265 
266  //**Default assignment to dense vectors*********************************************************
279  template< typename VT > // Type of the target dense vector
281  assign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
282  {
284 
285  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
286 
287  typedef ConstIterator_< RemoveReference_<CT1> > LeftIterator;
288  typedef ConstIterator_< RemoveReference_<CT2> > RightIterator;
289 
290  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
291  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
292 
293  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
294  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
295  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
296 
297  const LeftIterator lend( x.end() );
298  const RightIterator rend( y.end() );
299 
300  for( LeftIterator l=x.begin(); l!=lend; ++l ) {
301  (~lhs)[l->index()] = l->value();
302  }
303 
304  for( RightIterator r=y.begin(); r!=rend; ++r ) {
305  if( isDefault( (~lhs)[r->index()] ) )
306  (~lhs)[r->index()] = -r->value();
307  else
308  (~lhs)[r->index()] -= r->value();
309  }
310  }
312  //**********************************************************************************************
313 
314  //**Optimized assignment to dense vectors*******************************************************
327  template< typename VT > // Type of the target dense vector
329  assign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
330  {
332 
333  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
334 
335  typedef ConstIterator_< RemoveReference_<CT1> > LeftIterator;
336  typedef ConstIterator_< RemoveReference_<CT2> > RightIterator;
337 
338  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
339  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
340 
341  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
342  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
343  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
344 
345  const LeftIterator lend( x.end() );
346  const RightIterator rend( y.end() );
347 
348  for( LeftIterator l=x.begin(); l!=lend; ++l ) {
349  (~lhs)[l->index()] = l->value();
350  }
351 
352  for( RightIterator r=y.begin(); r!=rend; ++r ) {
353  (~lhs)[r->index()] -= r->value();
354  }
355  }
357  //**********************************************************************************************
358 
359  //**Assignment to sparse vectors****************************************************************
371  template< typename VT > // Type of the target sparse vector
372  friend inline void assign( SparseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
373  {
375 
376  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
377 
378  typedef ConstIterator_< RemoveReference_<CT1> > LeftIterator;
379  typedef ConstIterator_< RemoveReference_<CT2> > RightIterator;
380 
381  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
382  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
383 
384  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
385  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
386  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
387 
388  const LeftIterator lend( x.end() );
389  const RightIterator rend( y.end() );
390 
391  LeftIterator l( x.begin() );
392  RightIterator r( y.begin() );
393 
394  while( l != lend && r != rend )
395  {
396  if( l->index() < r->index() ) {
397  (~lhs).append( l->index(), l->value() );
398  ++l;
399  }
400  else if( l->index() > r->index() ) {
401  (~lhs).append( r->index(), -r->value() );
402  ++r;
403  }
404  else {
405  (~lhs).append( l->index(), l->value() - r->value() );
406  ++l;
407  ++r;
408  }
409  }
410 
411  while( l != lend ) {
412  (~lhs).append( l->index(), l->value() );
413  ++l;
414  }
415 
416  while( r != rend ) {
417  (~lhs).append( r->index(), -r->value() );
418  ++r;
419  }
420  }
422  //**********************************************************************************************
423 
424  //**Addition assignment to dense vectors********************************************************
436  template< typename VT > // Type of the target dense vector
437  friend inline void addAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
438  {
440 
441  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
442 
443  addAssign( ~lhs, rhs.lhs_ );
444  subAssign( ~lhs, rhs.rhs_ );
445  }
447  //**********************************************************************************************
448 
449  //**Addition assignment to sparse vectors*******************************************************
450  // No special implementation for the addition assignment to sparse vectors.
451  //**********************************************************************************************
452 
453  //**Subtraction assignment to dense vectors*****************************************************
465  template< typename VT > // Type of the target dense vector
466  friend inline void subAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
467  {
469 
470  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
471 
472  subAssign( ~lhs, rhs.lhs_ );
473  addAssign( ~lhs, rhs.rhs_ );
474  }
476  //**********************************************************************************************
477 
478  //**Subtraction assignment to sparse vectors****************************************************
479  // No special implementation for the subtraction assignment to sparse vectors.
480  //**********************************************************************************************
481 
482  //**Multiplication assignment to dense vectors**************************************************
494  template< typename VT > // Type of the target dense vector
495  friend inline void multAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
496  {
498 
501  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
502 
503  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
504 
505  const ResultType tmp( serial( rhs ) );
506  multAssign( ~lhs, tmp );
507  }
509  //**********************************************************************************************
510 
511  //**Multiplication assignment to sparse vectors*************************************************
512  // No special implementation for the multiplication assignment to sparse vectors.
513  //**********************************************************************************************
514 
515  //**SMP assignment to dense vectors*************************************************************
516  // No special implementation for the SMP assignment to dense vectors.
517  //**********************************************************************************************
518 
519  //**SMP assignment to sparse vectors************************************************************
520  // No special implementation for the SMP assignment to sparse vectors.
521  //**********************************************************************************************
522 
523  //**SMP addition assignment to dense vectors****************************************************
537  template< typename VT > // Type of the target dense vector
538  friend inline EnableIf_< UseSMPAssign<VT> >
539  smpAddAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
540  {
542 
543  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
544 
545  smpAddAssign( ~lhs, rhs.lhs_ );
546  smpSubAssign( ~lhs, rhs.rhs_ );
547  }
549  //**********************************************************************************************
550 
551  //**SMP addition assignment to sparse vectors***************************************************
552  // No special implementation for the SMP addition assignment to sparse vectors.
553  //**********************************************************************************************
554 
555  //**SMP subtraction assignment to dense vectors*************************************************
570  template< typename VT > // Type of the target dense vector
571  friend inline EnableIf_< UseSMPAssign<VT> >
572  smpSubAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
573  {
575 
576  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
577 
578  smpSubAssign( ~lhs, rhs.lhs_ );
579  smpAddAssign( ~lhs, rhs.rhs_ );
580  }
582  //**********************************************************************************************
583 
584  //**SMP subtraction assignment to sparse vectors************************************************
585  // No special implementation for the SMP subtraction assignment to sparse vectors.
586  //**********************************************************************************************
587 
588  //**SMP multiplication assignment to dense vectors**********************************************
603  template< typename VT > // Type of the target dense vector
604  friend inline EnableIf_< UseSMPAssign<VT> >
605  smpMultAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
606  {
608 
611  BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( CompositeType_<ResultType> );
612 
613  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
614 
615  const ResultType tmp( rhs );
616  smpMultAssign( ~lhs, tmp );
617  }
619  //**********************************************************************************************
620 
621  //**SMP multiplication assignment to sparse vectors*********************************************
622  // No special implementation for the SMP multiplication assignment to sparse vectors.
623  //**********************************************************************************************
624 
625  //**Compile time checks*************************************************************************
633  //**********************************************************************************************
634 };
635 //*************************************************************************************************
636 
637 
638 
639 
640 //=================================================================================================
641 //
642 // GLOBAL BINARY ARITHMETIC OPERATORS
643 //
644 //=================================================================================================
645 
646 //*************************************************************************************************
670 template< typename T1 // Type of the left-hand side sparse vector
671  , typename T2 // Type of the right-hand side sparse vector
672  , bool TF > // Transpose flag
673 inline const SVecSVecSubExpr<T1,T2,TF>
675 {
677 
678  if( (~lhs).size() != (~rhs).size() ) {
679  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
680  }
681 
682  return SVecSVecSubExpr<T1,T2,TF>( ~lhs, ~rhs );
683 }
684 //*************************************************************************************************
685 
686 
687 
688 
689 //=================================================================================================
690 //
691 // SIZE SPECIALIZATIONS
692 //
693 //=================================================================================================
694 
695 //*************************************************************************************************
697 template< typename VT1, typename VT2, bool TF >
698 struct Size< SVecSVecSubExpr<VT1,VT2,TF> >
699  : public Max< Size<VT1>, Size<VT2> >
700 {};
702 //*************************************************************************************************
703 
704 
705 
706 
707 //=================================================================================================
708 //
709 // EXPRESSION TRAIT SPECIALIZATIONS
710 //
711 //=================================================================================================
712 
713 //*************************************************************************************************
715 template< typename VT1, typename VT2, bool TF, bool AF >
716 struct SubvectorExprTrait< SVecSVecSubExpr<VT1,VT2,TF>, AF >
717 {
718  public:
719  //**********************************************************************************************
720  using Type = SubExprTrait_< SubvectorExprTrait_<const VT1,AF>
721  , SubvectorExprTrait_<const VT2,AF> >;
722  //**********************************************************************************************
723 };
725 //*************************************************************************************************
726 
727 } // namespace blaze
728 
729 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for the Max class template.
Header file for mathematical functions.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecSVecSubExpr.h:243
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:70
Header file for the subtraction trait.
SubExprTrait_< RN1, RN2 > ExprReturnType
Expression return type for the subscript operator.
Definition: SVecSVecSubExpr.h:116
Header file for basic type definitions.
Header file for the SparseVector base class.
SVecSVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecSVecSubExpr class.
Definition: SVecSVecSubExpr.h:161
CompositeType_< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:102
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecSVecSubExpr.h:221
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
LeftOperand lhs_
Left-hand side sparse vector of the subtraction expression.
Definition: SVecSVecSubExpr.h:262
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecSVecSubExpr.h:144
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
Header file for the Computation base class.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
ElementType_< ResultType > ElementType
Resulting element type.
Definition: SVecSVecSubExpr.h:138
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecSVecSubExpr.h:201
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
ResultType_< VT1 > RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:98
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecSVecSubExpr.h:188
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
typename SubExprTrait< T1, T2 >::Type SubExprTrait_
Auxiliary alias declaration for the SubExprTrait class template.The SubExprTrait_ alias declaration p...
Definition: SubExprTrait.h:220
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: SVecSVecSubExpr.h:231
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Expression object for sparse vector-sparse vector subtractions.The SVecSVecSubExpr class represents t...
Definition: Forward.h:123
#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
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecSVecSubExpr.h:175
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecSVecSubExpr.h:255
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
ReturnType_< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:100
#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
CompositeType_< VT2 > CT2
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:103
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:60
ResultType_< VT2 > RT2
Result type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:99
Header file for the exception macros of the math module.
SubTrait_< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SVecSVecSubExpr.h:136
Header file for the VecVecSubExpr base class.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for run time assertion macros.
ReturnType_< VT2 > RN2
Return type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:101
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:160
Header file for the isDefault shim.
TransposeType_< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecSVecSubExpr.h:137
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
const IfTrue_< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecSVecSubExpr.h:141
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecSVecSubExpr.h:211
Constraint on the data type.
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
SVecSVecSubExpr< VT1, VT2, TF > This
Type of this SVecSVecSubExpr instance.
Definition: SVecSVecSubExpr.h:135
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECSUBEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecVecSubExpr.h:109
Header file for the IsComputation type trait class.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
RightOperand rhs_
Right-hand side sparse vector of the subtraction expression.
Definition: SVecSVecSubExpr.h:263
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
Header file for the SubvectorExprTrait class template.
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
If_< IsExpression< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:147
Header file for the IsResizable type trait.
Header file for the SubExprTrait class template.
If_< IsExpression< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:150
Header file for the Size type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.