35#ifndef _BLAZE_MATH_EXPRESSIONS_SVECDVECSUBEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SVECDVECSUBEXPR_H_
89 :
public VecVecSubExpr< DenseVector< SVecDVecSubExpr<VT1,VT2,TF>, TF > >
111 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
124 template<
typename VT >
125 static constexpr bool UseSMPAssign_v = ( !VT1::smpAssignable || !VT2::smpAssignable );
196 if( index >=
lhs_.size() ) {
199 return (*
this)[index];
208 inline size_t size() const noexcept {
239 template<
typename T >
240 inline bool canAlias(
const T* alias )
const noexcept {
241 return (
lhs_.canAlias( alias ) ) ||
242 ( IsExpression_v<VT2> &&
rhs_.canAlias( alias ) );
252 template<
typename T >
253 inline bool isAliased(
const T* alias )
const noexcept {
254 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
276 template<
typename VT >
283 assign ( *lhs, -rhs.
rhs_ );
284 addAssign( *lhs, rhs.
lhs_ );
301 template<
typename VT >
330 template<
typename VT >
331 friend inline void addAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
337 subAssign( *lhs, rhs.rhs_ );
338 addAssign( *lhs, rhs.lhs_ );
359 template<
typename VT >
360 friend inline void subAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
366 addAssign( *lhs, rhs.rhs_ );
367 subAssign( *lhs, rhs.lhs_ );
388 template<
typename VT >
389 friend inline void multAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
400 multAssign( *lhs, tmp );
421 template<
typename VT >
422 friend inline void divAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
433 divAssign( *lhs, tmp );
456 template<
typename VT >
458 -> EnableIf_t< UseSMPAssign_v<VT> >
484 template<
typename VT >
486 -> EnableIf_t< UseSMPAssign_v<VT> >
516 template<
typename VT >
518 -> EnableIf_t< UseSMPAssign_v<VT> >
548 template<
typename VT >
550 -> EnableIf_t< UseSMPAssign_v<VT> >
581 template<
typename VT >
583 -> EnableIf_t< UseSMPAssign_v<VT> >
617 template<
typename VT >
619 -> EnableIf_t< UseSMPAssign_v<VT> >
673template<
typename VT1
676 , DisableIf_t< IsZero_v<VT1> &&
677 IsSame_v< ElementType_t<VT1>, ElementType_t<VT2> > >* =
nullptr >
678inline const SVecDVecSubExpr<VT1,VT2,TF>
679 svecdvecsub(
const SparseVector<VT1,TF>& lhs,
const DenseVector<VT2,TF>& rhs )
685 return SVecDVecSubExpr<VT1,VT2,TF>( *lhs, *rhs );
704template<
typename VT1
707 , EnableIf_t< IsZero_v<VT1> &&
708 IsSame_v< ElementType_t<VT1>, ElementType_t<VT2> > >* =
nullptr >
710 svecdvecsub(
const SparseVector<VT1,TF>& lhs,
const DenseVector<VT2,TF>& rhs )
750template<
typename VT1
758 if( (*lhs).size() != (*rhs).size() ) {
762 return svecdvecsub( *lhs, *rhs );
788template<
typename VT1
793 operator+(
const SVecDVecSubExpr<VT1,VT2,TF>& lhs,
const DenseVector<VT3,TF>& rhs )
797 return ( (*rhs) - lhs.rightOperand() ) + lhs.leftOperand();
816template<
typename VT1
821 operator-(
const SVecDVecSubExpr<VT1,VT2,TF>& lhs,
const DenseVector<VT3,TF>& rhs )
825 return lhs.leftOperand() - ( lhs.rightOperand() + (*rhs) );
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsExpression type trait class.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for the MAYBE_UNUSED function template.
Header file for the subtraction trait.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Expression object for sparse vector-dense vector subtractions.
Definition: SVecDVecSubExpr.h:91
decltype(std::declval< RN1 >() - std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: SVecDVecSubExpr.h:114
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: SVecDVecSubExpr.h:240
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse vector operand.
Definition: SVecDVecSubExpr.h:218
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecDVecSubExpr.h:182
LeftOperand lhs_
Left-hand side sparse vector of the subtraction expression.
Definition: SVecDVecSubExpr.h:260
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: SVecDVecSubExpr.h:111
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:148
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecDVecSubExpr.h:195
ReturnType_t< VT1 > RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:96
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: SVecDVecSubExpr.h:228
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:151
CompositeType_t< VT1 > CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:98
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: SVecDVecSubExpr.h:261
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: SVecDVecSubExpr.h:159
SubTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: SVecDVecSubExpr.h:137
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: SVecDVecSubExpr.h:139
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: SVecDVecSubExpr.h:208
SVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the SVecDVecSubExpr class.
Definition: SVecDVecSubExpr.h:168
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: SVecDVecSubExpr.h:138
TransposeType_t< VT2 > TT2
Transpose type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:101
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:97
TransposeType_t< VT1 > TT1
Transpose type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:100
ResultType_t< VT1 > RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:94
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:99
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: SVecDVecSubExpr.h:142
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:95
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: SVecDVecSubExpr.h:156
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: SVecDVecSubExpr.h:253
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecDVecSubExpr.h:145
Base class for sparse vectors.
Definition: SparseVector.h:72
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the DenseVector base class.
Header file for the VecVecSubExpr base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition: TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECVECSUBEXPR(T1, T2)
Constraint on the data type.
Definition: VecVecSubExpr.h:104
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition: SubTrait.h:163
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:221
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
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
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:192
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all vector/vector subtraction expression templates.
Definition: VecVecSubExpr.h:68
Header file for the IsZero type trait.
Header file for basic type definitions.