35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECSVECSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECSVECSUBEXPR_H_
84 template<
typename VT1
138 enum { vectorizable = 0 };
141 enum { smpAssignable = 0 };
206 template<
typename T >
209 (
rhs_.canAlias( alias ) );
219 template<
typename T >
221 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
243 template<
typename VT >
273 template<
typename VT >
302 template<
typename VT >
331 template<
typename VT >
360 template<
typename VT >
427 template<
typename T1
430 inline const DVecSVecSubExpr<T1,T2,TF>
435 if( (~lhs).size() != (~rhs).size() )
436 throw std::invalid_argument(
"Vector sizes do not match" );
464 template<
typename T1
468 inline const typename AddExprTrait< DVecSVecSubExpr<T1,T2,TF>, T3 >::Type
469 operator+(
const DVecSVecSubExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
473 return ( lhs.leftOperand() + (~rhs) ) - lhs.rightOperand();
492 template<
typename T1
496 inline const typename SubExprTrait< DVecSVecSubExpr<T1,T2,TF>, T3 >::Type
497 operator-(
const DVecSVecSubExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
501 return ( lhs.leftOperand() - (~rhs) ) - lhs.rightOperand();
517 template<
typename VT1,
typename VT2,
typename VT3 >
518 struct DVecDVecAddExprTrait< DVecSVecSubExpr<VT1,VT2,false>, VT3 >
523 typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
524 IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
525 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
526 ,
typename DVecSVecSubExprTrait< typename DVecDVecAddExprTrait<VT1,VT3>::Type, VT2 >::Type
527 , INVALID_TYPE >::Type Type;
537 template<
typename VT1,
typename VT2,
typename VT3 >
538 struct TDVecTDVecAddExprTrait< DVecSVecSubExpr<VT1,VT2,true>, VT3 >
543 typedef typename SelectType< IsDenseVector<VT1>::value && IsRowVector<VT1>::value &&
544 IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
545 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
546 ,
typename TDVecTSVecSubExprTrait< typename TDVecTDVecAddExprTrait<VT1,VT3>::Type, VT2 >::Type
547 , INVALID_TYPE >::Type Type;
557 template<
typename VT1,
typename VT2,
typename VT3 >
558 struct DVecDVecSubExprTrait< DVecSVecSubExpr<VT1,VT2,false>, VT3 >
563 typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
564 IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
565 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
566 ,
typename DVecSVecSubExprTrait< typename DVecDVecSubExprTrait<VT1,VT3>::Type, VT2 >::Type
567 , INVALID_TYPE >::Type Type;
577 template<
typename VT1,
typename VT2,
typename VT3 >
578 struct TDVecTDVecSubExprTrait< DVecSVecSubExpr<VT1,VT2,true>, VT3 >
583 typedef typename SelectType< IsDenseVector<VT1>::value && IsRowVector<VT1>::value &&
584 IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
585 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
586 ,
typename TDVecTSVecSubExprTrait< typename TDVecTDVecSubExprTrait<VT1,VT3>::Type, VT2 >::Type
587 , INVALID_TYPE >::Type Type;
597 template<
typename VT1,
typename VT2,
bool TF >
598 struct SubvectorExprTrait< DVecSVecSubExpr<VT1,VT2,TF> >
602 typedef typename SubExprTrait< typename SubvectorExprTrait<const VT1>::Type
603 ,
typename SubvectorExprTrait<const VT2>::Type >::Type Type;
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecSVecSubExpr.h:121
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
VT2::ReturnType RN2
Return type of the right-hand side sparse vector expression.
Definition: DVecSVecSubExpr.h:96
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for the subtraction trait.
VT1::ResultType RT1
Result type of the left-hand side dense vector expression.
Definition: DVecSVecSubExpr.h:93
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: DVecSVecSubExpr.h:195
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
RightOperand rhs_
Right-hand side sparse vector of the subtraction expression.
Definition: DVecSVecSubExpr.h:228
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecSVecSubExpr.h:124
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2375
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:248
Header file for the DenseVector base class.
Header file for the AddExprTrait class template.
DVecSVecSubExpr< VT1, VT2, TF > This
Type of this DVecSVecSubExpr instance.
Definition: DVecSVecSubExpr.h:118
SubTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecSVecSubExpr.h:119
Header file for the Computation base class.
Constraint on the data type.
Expression object for dense vector-sparse vector subtractions.The DVecSVecSubExpr class represents th...
Definition: DVecSVecSubExpr.h:87
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecSVecSubExpr.h:207
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:250
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.
const ResultType CompositeType
Data type for composite expression templates.
Definition: DVecSVecSubExpr.h:127
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecSVecSubExpr.h:120
VT2::TransposeType TT2
Transpose type of the right-hand side sparse vector expression.
Definition: DVecSVecSubExpr.h:100
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2372
Constraint on the data type.
Evaluation of the return type of a subtraction expression.Via this type trait it is possible to evalu...
Definition: SubExprTrait.h:103
SubExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecSVecSubExpr.h:113
VT2::CompositeType CT2
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecSubExpr.h:98
void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:269
Header file for the VecVecSubExpr base class.
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecSVecSubExpr.h:185
VT1::TransposeType TT1
Transpose type of the left-hand side dense vector expression.
Definition: DVecSVecSubExpr.h:99
DVecSVecSubExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecSVecSubExpr class.
Definition: DVecSVecSubExpr.h:150
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2374
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecSubExpr.h:133
Header file for run time assertion macros.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:239
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecSVecSubExpr.h:95
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecSubExpr.h:130
Header file for the IsDenseVector type trait.
LeftOperand lhs_
Left-hand side dense vector of the subtraction expression.
Definition: DVecSVecSubExpr.h:227
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecSVecSubExpr.h:175
Header file for the IsComputation type trait class.
VT2::ResultType RT2
Result type of the right-hand side sparse vector expression.
Definition: DVecSVecSubExpr.h:94
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2370
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
Base template for the SubTrait class.
Definition: SubTrait.h:141
Header file for the IsColumnVector type trait.
Base class for all vector/vector subtraction expression templates.The VecVecSubExpr class serves as a...
Definition: VecVecSubExpr.h:65
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecSVecSubExpr.h:164
Header file for the SubExprTrait class template.
#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:238
#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
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecSVecSubExpr.h:220
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecSubExpr.h:97