35 #ifndef _BLAZE_MATH_EXPRESSIONS_DVECSVECADDEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DVECSVECADDEXPR_H_
85 template<
typename VT1
124 template<
typename VT >
125 struct UseSMPAssign {
126 enum { value = ( !VT1::smpAssignable || !VT2::smpAssignable ) };
153 enum { vectorizable = 0 };
156 enum { smpAssignable = 0 };
221 template<
typename T >
224 (
rhs_.canAlias( alias ) );
234 template<
typename T >
236 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
258 template<
typename VT >
288 template<
typename VT >
317 template<
typename VT >
346 template<
typename VT >
375 template<
typename VT >
410 template<
typename VT >
411 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
418 if( !IsComputation<VT1>::value &&
isSame( ~lhs, rhs.lhs_ ) ) {
443 template<
typename VT >
444 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
475 template<
typename VT >
476 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
507 template<
typename VT >
508 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
540 template<
typename VT >
541 friend inline typename EnableIf< UseSMPAssign<VT> >::Type
608 template<
typename T1
611 inline const DVecSVecAddExpr<T1,T2,TF>
616 if( (~lhs).
size() != (~rhs).
size() )
617 throw std::invalid_argument(
"Vector sizes do not match" );
650 template<
typename T1
653 inline const DVecSVecAddExpr<T2,T1,TF>
658 if( (~lhs).
size() != (~rhs).
size() )
659 throw std::invalid_argument(
"Vector sizes do not match" );
687 template<
typename T1
691 inline const typename AddExprTrait< DVecSVecAddExpr<T1,T2,TF>, T3 >::Type
692 operator+(
const DVecSVecAddExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
696 return ( lhs.leftOperand() + (~rhs) ) + lhs.rightOperand();
715 template<
typename T1
719 inline const typename SubExprTrait< DVecSVecAddExpr<T1,T2,TF>, T3 >::Type
720 operator-(
const DVecSVecAddExpr<T1,T2,TF>& lhs,
const DenseVector<T3,TF>& rhs )
724 return ( lhs.leftOperand() - (~rhs) ) + lhs.rightOperand();
740 template<
typename VT1,
typename VT2,
typename VT3 >
746 typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
747 IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
748 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
749 ,
typename DVecSVecAddExprTrait< typename DVecDVecAddExprTrait<VT1,VT3>::Type, VT2 >::Type
750 , INVALID_TYPE >::Type Type;
760 template<
typename VT1,
typename VT2,
typename VT3 >
766 typedef typename SelectType< IsDenseVector<VT1>::value && IsRowVector<VT1>::value &&
767 IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
768 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
769 ,
typename TDVecTSVecAddExprTrait< typename TDVecTDVecAddExprTrait<VT1,VT3>::Type, VT2 >::Type
770 , INVALID_TYPE >::Type Type;
780 template<
typename VT1,
typename VT2,
typename VT3 >
786 typedef typename SelectType< IsDenseVector<VT1>::value && IsColumnVector<VT1>::value &&
787 IsSparseVector<VT2>::value && IsColumnVector<VT2>::value &&
788 IsDenseVector<VT3>::value && IsColumnVector<VT3>::value
789 ,
typename DVecSVecAddExprTrait< typename DVecDVecSubExprTrait<VT1,VT3>::Type, VT2 >::Type
790 , INVALID_TYPE >::Type Type;
800 template<
typename VT1,
typename VT2,
typename VT3 >
806 typedef typename SelectType< IsDenseVector<VT1>::value && IsRowVector<VT1>::value &&
807 IsSparseVector<VT2>::value && IsRowVector<VT2>::value &&
808 IsDenseVector<VT3>::value && IsRowVector<VT3>::value
809 ,
typename TDVecTSVecAddExprTrait< typename TDVecTDVecSubExprTrait<VT1,VT3>::Type, VT2 >::Type
810 , INVALID_TYPE >::Type Type;
820 template<
typename VT1,
typename VT2,
bool TF,
bool AF >
825 typedef typename AddExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
826 ,
typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
VT2::ResultType RT2
Result type of the right-hand side sparse vector expression.
Definition: DVecSVecAddExpr.h:95
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: DVecSVecAddExpr.h:235
Compile time check whether the given type is a computational expression template.This type trait clas...
Definition: IsComputation.h:89
RightOperand rhs_
Right-hand side sparse vector of the addition expression.
Definition: DVecSVecAddExpr.h:243
Evaluation of the return type of an addition expression.Via this type trait it is possible to evaluat...
Definition: AddExprTrait.h:103
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
VT2::ReturnType RN2
Return type of the right-hand side sparse vector expression.
Definition: DVecSVecAddExpr.h:97
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DVecSVecAddExpr.h:135
VT1::ResultType RT1
Result type of the left-hand side dense vector expression.
Definition: DVecSVecAddExpr.h:94
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
VT1::CompositeType CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecAddExpr.h:98
void smpMultAssign(DenseVector< 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:179
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Header file for the IsRowVector type trait.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:251
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:690
Header file for the Computation base class.
Expression object for dense vector-sparse vector additions.The DVecSVecAddExpr class represents the c...
Definition: DVecSVecAddExpr.h:88
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:409
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: DVecSVecAddExpr.h:210
Constraint on the data type.
VT1::TransposeType TT1
Transpose type of the left-hand side dense vector expression.
Definition: DVecSVecAddExpr.h:100
void smpAddAssign(DenseMatrix< 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:122
LeftOperand leftOperand() const
Returns the left-hand side dense vector operand.
Definition: DVecSVecAddExpr.h:200
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:253
VT2::TransposeType TT2
Transpose type of the right-hand side sparse vector expression.
Definition: DVecSVecAddExpr.h:101
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.
Header file for the VecVecAddExpr base class.
DVecSVecAddExpr< VT1, VT2, TF > This
Type of this DVecSVecAddExpr instance.
Definition: DVecSVecAddExpr.h:133
ResultType::ElementType ElementType
Resulting element type.
Definition: DVecSVecAddExpr.h:136
const ResultType CompositeType
Data type for composite expression templates.
Definition: DVecSVecAddExpr.h:142
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:271
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.
LeftOperand lhs_
Left-hand side dense vector of the addition expression.
Definition: DVecSVecAddExpr.h:242
#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:2405
Constraint on the data type.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: DVecSVecAddExpr.h:222
VT2::CompositeType CT2
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecAddExpr.h:99
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:361
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Base class for all vector/vector addition expression templates.The VecVecAddExpr class serves as a ta...
Definition: VecVecAddExpr.h:65
Header file for the serial shim.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
AddExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: DVecSVecAddExpr.h:114
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
Header file for the addition trait.
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:301
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:331
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecSVecAddExpr.h:145
DVecSVecAddExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the DVecSVecAddExpr class.
Definition: DVecSVecAddExpr.h:165
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: DVecSVecAddExpr.h:139
size_t size() const
Returns the current size/dimension of the vector.
Definition: DVecSVecAddExpr.h:190
Header file for the IsDenseVector type trait.
#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
AddTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: DVecSVecAddExpr.h:134
Header file for the IsComputation type trait class.
Base class for all compute expression templates.The Computation class serves as a tag for all computa...
Definition: Computation.h:59
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecSVecAddExpr.h:179
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#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:2403
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: DVecSVecAddExpr.h:148
VT1::ReturnType RN1
Return type of the left-hand side dense vector expression.
Definition: DVecSVecAddExpr.h:96
Header file for the IsColumnVector type trait.
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
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.