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 <utility>
44 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
64 #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/Types.h>
71 #include <blaze/util/Unused.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
93  : public VecVecSubExpr< SparseVector< SVecSVecSubExpr<VT1,VT2,TF>, TF > >
94  , private Computation
95 {
96  private:
97  //**Type definitions****************************************************************************
104  //**********************************************************************************************
105 
106  //**Return type evaluation**********************************************************************
108 
113  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
114 
116  using ExprReturnType = decltype( std::declval<RN1>() - std::declval<RN2>() );
117  //**********************************************************************************************
118 
119  //**Parallel evaluation strategy****************************************************************
121 
126  template< typename VT >
127  static constexpr bool UseSMPAssign_v = VT::smpAssignable;
129  //**********************************************************************************************
130 
131  public:
132  //**Type definitions****************************************************************************
138 
141 
143  using CompositeType = const ResultType;
144 
146  using LeftOperand = If_t< IsExpression_v<VT1>, const VT1, const VT1& >;
147 
149  using RightOperand = If_t< IsExpression_v<VT2>, const VT2, const VT2& >;
150  //**********************************************************************************************
151 
152  //**Compilation flags***************************************************************************
154  static constexpr bool smpAssignable = false;
155  //**********************************************************************************************
156 
157  //**Constructor*********************************************************************************
160  explicit inline SVecSVecSubExpr( const VT1& lhs, const VT2& rhs ) noexcept
161  : lhs_( lhs ) // Left-hand side sparse vector of the subtraction expression
162  , rhs_( rhs ) // Right-hand side sparse vector of the subtraction expression
163  {
164  BLAZE_INTERNAL_ASSERT( lhs.size() == rhs.size(), "Invalid vector sizes" );
165  }
166  //**********************************************************************************************
167 
168  //**Subscript operator**************************************************************************
174  inline ReturnType operator[]( size_t index ) const {
175  BLAZE_INTERNAL_ASSERT( index < lhs_.size(), "Invalid vector access index" );
176  return lhs_[index] - rhs_[index];
177  }
178  //**********************************************************************************************
179 
180  //**At function*********************************************************************************
187  inline ReturnType at( size_t index ) const {
188  if( index >= lhs_.size() ) {
189  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
190  }
191  return (*this)[index];
192  }
193  //**********************************************************************************************
194 
195  //**Size function*******************************************************************************
200  inline size_t size() const noexcept {
201  return lhs_.size();
202  }
203  //**********************************************************************************************
204 
205  //**NonZeros function***************************************************************************
210  inline size_t nonZeros() const {
211  return min( lhs_.size(), lhs_.nonZeros() + rhs_.nonZeros() );
212  }
213  //**********************************************************************************************
214 
215  //**Left operand access*************************************************************************
220  inline LeftOperand leftOperand() const noexcept {
221  return lhs_;
222  }
223  //**********************************************************************************************
224 
225  //**Right operand access************************************************************************
230  inline RightOperand rightOperand() const noexcept {
231  return rhs_;
232  }
233  //**********************************************************************************************
234 
235  //**********************************************************************************************
241  template< typename T >
242  inline bool canAlias( const T* alias ) const noexcept {
243  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
244  }
245  //**********************************************************************************************
246 
247  //**********************************************************************************************
253  template< typename T >
254  inline bool isAliased( const T* alias ) const noexcept {
255  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
256  }
257  //**********************************************************************************************
258 
259  private:
260  //**Member variables****************************************************************************
263  //**********************************************************************************************
264 
265  //**Default assignment to dense vectors*********************************************************
278  template< typename VT > // Type of the target dense vector
279  friend inline auto assign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
281  {
283 
284  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
285 
286  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
287  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
288 
289  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
290  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
291  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
292 
293  const auto lend( x.end() );
294  const auto rend( y.end() );
295 
296  for( auto l=x.begin(); l!=lend; ++l ) {
297  (~lhs)[l->index()] = l->value();
298  }
299 
300  for( auto r=y.begin(); r!=rend; ++r ) {
301  if( isDefault( (~lhs)[r->index()] ) )
302  (~lhs)[r->index()] = -r->value();
303  else
304  (~lhs)[r->index()] -= r->value();
305  }
306  }
308  //**********************************************************************************************
309 
310  //**Optimized assignment to dense vectors*******************************************************
323  template< typename VT > // Type of the target dense vector
324  friend inline auto assign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
326  {
328 
329  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
330 
331  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
332  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
333 
334  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
335  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
336  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
337 
338  const auto lend( x.end() );
339  const auto rend( y.end() );
340 
341  for( auto l=x.begin(); l!=lend; ++l ) {
342  (~lhs)[l->index()] = l->value();
343  }
344 
345  for( auto r=y.begin(); r!=rend; ++r ) {
346  (~lhs)[r->index()] -= r->value();
347  }
348  }
350  //**********************************************************************************************
351 
352  //**Assignment to sparse vectors****************************************************************
364  template< typename VT > // Type of the target sparse vector
365  friend inline void assign( SparseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
366  {
368 
369  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
370 
371  CT1 x( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse vector operand
372  CT2 y( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse vector operand
373 
374  BLAZE_INTERNAL_ASSERT( x.size() == rhs.lhs_.size(), "Invalid vector size" );
375  BLAZE_INTERNAL_ASSERT( y.size() == rhs.rhs_.size(), "Invalid vector size" );
376  BLAZE_INTERNAL_ASSERT( x.size() == (~lhs).size() , "Invalid vector size" );
377 
378  // Final memory allocation (based on the evaluated operands)
379  (~lhs).reserve( min( x.size(), x.nonZeros() + y.nonZeros() ) );
380 
381  // Performing the vector subtraction
382  const auto lend( x.end() );
383  const auto rend( y.end() );
384 
385  auto l( x.begin() );
386  auto r( y.begin() );
387 
388  while( l != lend && r != rend )
389  {
390  if( l->index() < r->index() ) {
391  (~lhs).append( l->index(), l->value() );
392  ++l;
393  }
394  else if( l->index() > r->index() ) {
395  (~lhs).append( r->index(), -r->value() );
396  ++r;
397  }
398  else {
399  (~lhs).append( l->index(), l->value() - r->value() );
400  ++l;
401  ++r;
402  }
403  }
404 
405  while( l != lend ) {
406  (~lhs).append( l->index(), l->value() );
407  ++l;
408  }
409 
410  while( r != rend ) {
411  (~lhs).append( r->index(), -r->value() );
412  ++r;
413  }
414  }
416  //**********************************************************************************************
417 
418  //**Addition assignment to dense vectors********************************************************
430  template< typename VT > // Type of the target dense vector
431  friend inline void addAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
432  {
434 
435  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
436 
437  addAssign( ~lhs, rhs.lhs_ );
438  subAssign( ~lhs, rhs.rhs_ );
439  }
441  //**********************************************************************************************
442 
443  //**Addition assignment to sparse vectors*******************************************************
444  // No special implementation for the addition assignment to sparse vectors.
445  //**********************************************************************************************
446 
447  //**Subtraction assignment to dense vectors*****************************************************
459  template< typename VT > // Type of the target dense vector
460  friend inline void subAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
461  {
463 
464  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
465 
466  subAssign( ~lhs, rhs.lhs_ );
467  addAssign( ~lhs, rhs.rhs_ );
468  }
470  //**********************************************************************************************
471 
472  //**Subtraction assignment to sparse vectors****************************************************
473  // No special implementation for the subtraction assignment to sparse vectors.
474  //**********************************************************************************************
475 
476  //**Multiplication assignment to dense vectors**************************************************
488  template< typename VT > // Type of the target dense vector
489  friend inline void multAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
490  {
492 
496 
497  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
498 
499  const ResultType tmp( serial( rhs ) );
500  multAssign( ~lhs, tmp );
501  }
503  //**********************************************************************************************
504 
505  //**Multiplication assignment to sparse vectors*************************************************
506  // No special implementation for the multiplication assignment to sparse vectors.
507  //**********************************************************************************************
508 
509  //**SMP assignment to dense vectors*************************************************************
510  // No special implementation for the SMP assignment to dense vectors.
511  //**********************************************************************************************
512 
513  //**SMP assignment to sparse vectors************************************************************
514  // No special implementation for the SMP assignment to sparse vectors.
515  //**********************************************************************************************
516 
517  //**SMP addition assignment to dense vectors****************************************************
531  template< typename VT > // Type of the target dense vector
532  friend inline auto smpAddAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
533  -> EnableIf_t< UseSMPAssign_v<VT> >
534  {
536 
537  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
538 
539  smpAddAssign( ~lhs, rhs.lhs_ );
540  smpSubAssign( ~lhs, rhs.rhs_ );
541  }
543  //**********************************************************************************************
544 
545  //**SMP addition assignment to sparse vectors***************************************************
546  // No special implementation for the SMP addition assignment to sparse vectors.
547  //**********************************************************************************************
548 
549  //**SMP subtraction assignment to dense vectors*************************************************
564  template< typename VT > // Type of the target dense vector
565  friend inline auto smpSubAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
566  -> EnableIf_t< UseSMPAssign_v<VT> >
567  {
569 
570  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
571 
572  smpSubAssign( ~lhs, rhs.lhs_ );
573  smpAddAssign( ~lhs, rhs.rhs_ );
574  }
576  //**********************************************************************************************
577 
578  //**SMP subtraction assignment to sparse vectors************************************************
579  // No special implementation for the SMP subtraction assignment to sparse vectors.
580  //**********************************************************************************************
581 
582  //**SMP multiplication assignment to dense vectors**********************************************
597  template< typename VT > // Type of the target dense vector
598  friend inline auto smpMultAssign( DenseVector<VT,TF>& lhs, const SVecSVecSubExpr& rhs )
599  -> EnableIf_t< UseSMPAssign_v<VT> >
600  {
602 
606 
607  BLAZE_INTERNAL_ASSERT( (~lhs).size() == rhs.size(), "Invalid vector sizes" );
608 
609  const ResultType tmp( rhs );
610  smpMultAssign( ~lhs, tmp );
611  }
613  //**********************************************************************************************
614 
615  //**SMP multiplication assignment to sparse vectors*********************************************
616  // No special implementation for the SMP multiplication assignment to sparse vectors.
617  //**********************************************************************************************
618 
619  //**Compile time checks*************************************************************************
627  //**********************************************************************************************
628 };
629 //*************************************************************************************************
630 
631 
632 
633 
634 //=================================================================================================
635 //
636 // GLOBAL BINARY ARITHMETIC OPERATORS
637 //
638 //=================================================================================================
639 
640 //*************************************************************************************************
652 template< typename VT1 // Type of the left-hand side sparse vector
653  , typename VT2 // Type of the right-hand side sparse vector
654  , bool TF // Transpose flag
655  , DisableIf_t< ( ( IsZero_v<VT1> || IsZero_v<VT2> ) &&
656  IsSame_v< ElementType_t<VT1>, ElementType_t<VT2> > ) ||
657  ( IsZero_v<VT1> && IsZero_v<VT2> ) >* = nullptr >
658 inline const SVecSVecSubExpr<VT1,VT2,TF>
659  svecsvecsub( const SparseVector<VT1,TF>& lhs, const SparseVector<VT2,TF>& rhs )
660 {
662 
663  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
664 
665  return SVecSVecSubExpr<VT1,VT2,TF>( ~lhs, ~rhs );
666 }
668 //*************************************************************************************************
669 
670 
671 //*************************************************************************************************
684 template< typename VT1 // Type of the left-hand side sparse vector
685  , typename VT2 // Type of the right-hand side sparse vector
686  , bool TF // Transpose flag
687  , EnableIf_t< !IsZero_v<VT1> && IsZero_v<VT2> &&
688  IsSame_v< ElementType_t<VT1>, ElementType_t<VT2> > >* = nullptr >
689 inline const VT1&
690  svecsvecsub( const SparseVector<VT1,TF>& lhs, const SparseVector<VT2,TF>& rhs )
691 {
693 
694  UNUSED_PARAMETER( rhs );
695 
696  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
697 
698  return (~lhs);
699 }
701 //*************************************************************************************************
702 
703 
704 //*************************************************************************************************
717 template< typename VT1 // Type of the left-hand side sparse vector
718  , typename VT2 // Type of the right-hand side sparse vector
719  , bool TF // Transpose flag
720  , EnableIf_t< IsZero_v<VT1> && !IsZero_v<VT2> &&
721  IsSame_v< ElementType_t<VT1>, ElementType_t<VT2> > >* = nullptr >
722 inline decltype(auto)
723  svecsvecsub( const SparseVector<VT1,TF>& lhs, const SparseVector<VT2,TF>& rhs )
724 {
726 
727  UNUSED_PARAMETER( lhs );
728 
729  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
730 
731  return -(~rhs);
732 }
734 //*************************************************************************************************
735 
736 
737 //*************************************************************************************************
749 template< typename VT1 // Type of the left-hand side sparse vector
750  , typename VT2 // Type of the right-hand side sparse vector
751  , bool TF // Transpose flag
752  , EnableIf_t< IsZero_v<VT1> && IsZero_v<VT2> >* = nullptr >
753 inline decltype(auto)
754  svecsvecsub( const SparseVector<VT1,TF>& lhs, const SparseVector<VT2,TF>& rhs )
755 {
757 
758  UNUSED_PARAMETER( rhs );
759 
760  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
761 
762  using ReturnType = const SubTrait_t< ResultType_t<VT1>, ResultType_t<VT2> >;
763 
766 
767  return ReturnType( (~lhs).size() );
768 }
770 //*************************************************************************************************
771 
772 
773 //*************************************************************************************************
797 template< typename VT1 // Type of the left-hand side sparse vector
798  , typename VT2 // Type of the right-hand side sparse vector
799  , bool TF > // Transpose flag
800 inline decltype(auto)
801  operator-( const SparseVector<VT1,TF>& lhs, const SparseVector<VT2,TF>& rhs )
802 {
804 
805  if( (~lhs).size() != (~rhs).size() ) {
806  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
807  }
808 
809  return svecsvecsub( ~lhs, ~rhs );
810 }
811 //*************************************************************************************************
812 
813 } // namespace blaze
814 
815 #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.
Headerfile for the generic min algorithm.
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.The SubTrait_t alias declaration provides...
Definition: SubTrait.h:238
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse vector.
Definition: SVecSVecSubExpr.h:210
SVecSVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecSVecSubExpr class.
Definition: SVecSVecSubExpr.h:160
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
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.
CompositeType_t< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:102
LeftOperand lhs_
Left-hand side sparse vector of the subtraction expression.
Definition: SVecSVecSubExpr.h:261
Header file for the IsSame and IsStrictlySame type traits.
ReturnType_t< VT2 > RN2
Return type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:101
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecSVecSubExpr.h:220
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecSVecSubExpr.h:242
Constraint on the data type.
Header file for the Computation base class.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecSVecSubExpr.h:143
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecSVecSubExpr.h:254
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
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecSVecSubExpr.h:174
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SVecSVecSubExpr.h:116
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecSVecSubExpr.h:200
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Expression object for sparse vector-sparse vector subtractions.The SVecSVecSubExpr class represents t...
Definition: Forward.h:154
ReturnType_t< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:100
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecSVecSubExpr.h:154
#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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#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
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_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Constraint on the data type.
Header file for the exception macros of the math module.
ResultType_t< VT2 > RT2
Result type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:99
Header file for the VecVecSubExpr base class.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
If_t< IsExpression_v< VT2 >, const VT2, const VT2 &> RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:149
Header file for the EnableIf class template.
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.
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse vector operand.
Definition: SVecSVecSubExpr.h:230
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 IsZero type trait.
#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 the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
If_t< IsExpression_v< VT1 >, const VT1, const VT1 &> LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:146
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
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SVecSVecSubExpr.h:135
CompositeType_t< VT2 > CT2
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:103
Constraint on the data type.
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecSVecSubExpr.h:140
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#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:104
Header file for the IsComputation type trait class.
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
RightOperand rhs_
Right-hand side sparse vector of the subtraction expression.
Definition: SVecSVecSubExpr.h:262
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SVecSVecSubExpr.h:113
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecSVecSubExpr.h:136
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecSVecSubExpr.h:187
Header file for the IsResizable type trait.
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SVecSVecSubExpr.h:137
#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
constexpr bool IsSame_v
Auxiliary variable template for the IsSame type trait.The IsSame_v variable template provides a conve...
Definition: IsSame.h:161
#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
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
ResultType_t< VT1 > RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecSVecSubExpr.h:98
Header file for the IsExpression type trait class.
Header file for the function trace functionality.