35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECDVECSUBEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECDVECSUBEXPR_H_
90 template<
typename VT1
93 class SVecDVecSubExpr :
public DenseVector< SVecDVecSubExpr<VT1,VT2,TF>, TF >
94 ,
private VecVecSubExpr
129 template<
typename VT >
130 struct UseSMPAssign {
131 enum { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) };
158 enum { vectorizable = 0 };
161 enum { smpAssignable = 0 };
197 inline ReturnType
at(
size_t index )
const {
198 if( index >=
lhs_.size() ) {
201 return (*
this)[index];
241 template<
typename T >
243 return (
lhs_.canAlias( alias ) ) ||
254 template<
typename T >
256 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
278 template<
typename VT >
285 assign ( ~lhs, -rhs.rhs_ );
286 addAssign( ~lhs, rhs.lhs_ );
303 template<
typename VT >
314 const ResultType tmp(
serial( rhs ) );
332 template<
typename VT >
333 friend inline void addAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
339 subAssign( ~lhs, rhs.rhs_ );
340 addAssign( ~lhs, rhs.lhs_ );
361 template<
typename VT >
362 friend inline void subAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
368 addAssign( ~lhs, rhs.rhs_ );
369 subAssign( ~lhs, rhs.lhs_ );
390 template<
typename VT >
391 friend inline void multAssign( DenseVector<VT,TF>& lhs,
const SVecDVecSubExpr& rhs )
401 const ResultType tmp(
serial( rhs ) );
402 multAssign( ~lhs, tmp );
425 template<
typename VT >
426 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
453 template<
typename VT >
454 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
465 const ResultType tmp( rhs );
485 template<
typename VT >
486 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
517 template<
typename VT >
518 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
550 template<
typename VT >
551 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
562 const ResultType tmp( rhs );
619 template<
typename T1
622 inline const SVecDVecSubExpr<T1,T2,TF>
627 if( (~lhs).
size() != (~rhs).
size() ) {
657 template<
typename T1
661 inline const typename AddExprTrait< SVecDVecSubExpr<T1,T2,TF>, T3 >::Type
662 operator+(
const SVecDVecSubExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
666 return ( (~rhs) - lhs.rightOperand() ) + lhs.leftOperand();
685 template<
typename T1
689 inline const typename SubExprTrait< SVecDVecSubExpr<T1,T2,TF>, T3 >::Type
690 operator-(
const SVecDVecSubExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
694 return lhs.leftOperand() - ( lhs.rightOperand() + (~rhs) );
710 template<
typename VT1,
typename VT2,
bool TF >
712 :
public Max< Size<VT1>, Size<VT2> >
728 template<
typename VT1,
typename VT2,
typename VT3 >
734 typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
735 IsDenseVector<VT2>::value && IsColumnVector<VT2>::value &&
736 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
737 ,
typename DVecSVecAddExprTrait< typename DVecDVecSubExprTrait<VT3,VT2>::Type, VT1 >::Type
738 , INVALID_TYPE >::Type Type;
748 template<
typename VT1,
typename VT2,
typename VT3 >
754 typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
755 IsDenseVector<VT2>::value && IsRowVector<VT2>::value &&
756 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
757 ,
typename TDVecTSVecAddExprTrait< typename TDVecTDVecSubExprTrait<VT3,VT2>::Type, VT1 >::Type
758 , INVALID_TYPE >::Type Type;
768 template<
typename VT1,
typename VT2,
typename VT3 >
774 typedef typename SelectType< IsSparseVector<VT1>::value && IsColumnVector<VT1>::value &&
775 IsDenseVector<VT2>::value && IsColumnVector<VT2>::value &&
776 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
777 ,
typename SVecDVecSubExprTrait< VT1, typename DVecDVecAddExprTrait<VT2,VT3>::Type >::Type
778 , INVALID_TYPE >::Type Type;
788 template<
typename VT1,
typename VT2,
typename VT3 >
794 typedef typename SelectType< IsSparseVector<VT1>::value && IsRowVector<VT1>::value &&
795 IsDenseVector<VT2>::value && IsRowVector<VT2>::value &&
796 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
797 ,
typename TSVecTDVecSubExprTrait< VT1, typename TDVecTDVecAddExprTrait<VT2,VT3>::Type >::Type
798 , INVALID_TYPE >::Type Type;
808 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
813 typedef typename SubExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
814 ,
typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Header file for the Max class template.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecDVecSubExpr.h:147
LeftOperand lhs_
Left-hand side sparse vector of the subtraction expression.
Definition: SVecDVecSubExpr.h:262
Expression object for sparse vector-dense vector subtractions.The SVecDVecSubExpr class represents th...
Definition: Forward.h:123
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.
Header file for basic type definitions.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
SubExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecDVecSubExpr.h:119
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
Header file for the DenseVector base class.
Header file for the AddExprTrait class template.
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.
VT1::ReturnType RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:101
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecDVecSubExpr.h:197
VT1::ResultType RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:99
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: SVecDVecSubExpr.h:220
SVecDVecSubExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the SVecDVecSubExpr class.
Definition: SVecDVecSubExpr.h:170
Constraint on the data type.
VT2::CompositeType CT2
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:104
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
RightOperand rightOperand() const
Returns the right-hand side dense vector operand.
Definition: SVecDVecSubExpr.h:230
RightOperand rhs_
Right-hand side dense vector of the subtraction expression.
Definition: SVecDVecSubExpr.h:263
VT2::TransposeType TT2
Transpose type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:106
VT2::ResultType RT2
Result type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:100
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.
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecDVecSubExpr.h:140
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#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
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:610
SVecDVecSubExpr< VT1, VT2, TF > This
Type of this SVecDVecSubExpr instance.
Definition: SVecDVecSubExpr.h:138
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
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
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:2585
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:104
Header file for the VecVecSubExpr base class.
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
SubTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: SVecDVecSubExpr.h:139
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the serial shim.
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecDVecSubExpr.h:255
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecDVecSubExpr.h:242
VT2::ReturnType RN2
Return type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:102
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:150
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
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Utility type for generic codes.
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecDVecSubExpr.h:144
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecDVecSubExpr.h:184
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side dense vector expression.
Definition: SVecDVecSubExpr.h:153
Header file for the IsDenseVector type trait.
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecDVecSubExpr.h:210
Constraint on the data type.
#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
#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:165
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
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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the SubvectorExprTrait class template.
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecDVecSubExpr.h:141
Base template for the SubTrait class.
Definition: SubTrait.h:138
Header file for exception macros.
Header file for the IsColumnVector type trait.
VT1::CompositeType CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:103
Header file for the SubExprTrait class template.
VT1::TransposeType TT1
Transpose type of the left-hand side sparse vector expression.
Definition: SVecDVecSubExpr.h:105
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.
#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
Compile time check whether the given type is an expression template.This type trait class tests wheth...
Definition: IsExpression.h:87
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.