35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECSVECCROSSEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECSVECCROSSEXPR_H_
82 template<
typename VT1
84 class SVecSVecCrossExpr :
public DenseVector< SVecSVecCrossExpr<VT1,VT2>, false >
142 enum { vectorizable = 0 };
145 enum { smpAssignable = 0 };
174 else if( index == 1UL )
175 return lhs_[2UL] * rhs_[0UL] -
lhs_[0UL] * rhs_[2UL];
177 return lhs_[0UL] * rhs_[1UL] -
lhs_[1UL] * rhs_[0UL];
188 inline ReturnType
at(
size_t index )
const {
192 return (*
this)[index];
232 template<
typename T >
234 return (
lhs_.canAlias( alias ) ||
rhs_.canAlias( alias ) );
244 template<
typename T >
246 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
268 template<
typename VT >
276 LT x(
serial( rhs.lhs_ ) );
277 RT y(
serial( rhs.rhs_ ) );
279 (~lhs)[0] = x[1UL]*y[2UL] - x[2UL]*y[1UL];
280 (~lhs)[1] = x[2UL]*y[0UL] - x[0UL]*y[2UL];
281 (~lhs)[2] = x[0UL]*y[1UL] - x[1UL]*y[0UL];
298 template<
typename VT >
310 const ResultType tmp(
serial( rhs ) );
328 template<
typename VT >
329 friend inline void addAssign( DenseVector<VT,false>& lhs,
const SVecSVecCrossExpr& rhs )
336 LT x(
serial( rhs.lhs_ ) );
337 RT y(
serial( rhs.rhs_ ) );
339 (~lhs)[0] += x[1UL]*y[2UL] - x[2UL]*y[1UL];
340 (~lhs)[1] += x[2UL]*y[0UL] - x[0UL]*y[2UL];
341 (~lhs)[2] += x[0UL]*y[1UL] - x[1UL]*y[0UL];
362 template<
typename VT >
363 friend inline void subAssign( DenseVector<VT,false>& lhs,
const SVecSVecCrossExpr& rhs )
370 LT x(
serial( rhs.lhs_ ) );
371 RT y(
serial( rhs.rhs_ ) );
373 (~lhs)[0] -= x[1UL]*y[2UL] - x[2UL]*y[1UL];
374 (~lhs)[1] -= x[2UL]*y[0UL] - x[0UL]*y[2UL];
375 (~lhs)[2] -= x[0UL]*y[1UL] - x[1UL]*y[0UL];
396 template<
typename VT >
397 friend inline void multAssign( DenseVector<VT,false>& lhs,
const SVecSVecCrossExpr& rhs )
404 LT x(
serial( rhs.lhs_ ) );
405 RT y(
serial( rhs.rhs_ ) );
407 (~lhs)[0] *= x[1UL]*y[2UL] - x[2UL]*y[1UL];
408 (~lhs)[1] *= x[2UL]*y[0UL] - x[0UL]*y[2UL];
409 (~lhs)[2] *= x[0UL]*y[1UL] - x[1UL]*y[0UL];
463 template<
typename T1
465 inline const SVecSVecCrossExpr<T1,T2>
470 if( (~lhs).
size() != 3UL || (~rhs).
size() != 3UL ) {
489 template<
typename VT1,
typename VT2 >
490 struct Size< SVecSVecCrossExpr<VT1,VT2> > :
public SizeT<3UL>
#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
size_t size() const
Returns the current size/dimension of the vector.
Definition: SVecSVecCrossExpr.h:201
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:131
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 basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
const StaticVector< ET2, 3UL, false > RT
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:137
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:79
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
VT2::ResultType RT2
Result type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:91
Header file for the DenseVector base class.
VT2::ReturnType RN2
Return type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:93
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.
Header file for the SizeT class template.
SVecSVecCrossExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the SVecSVecCrossExpr class.
Definition: SVecSVecCrossExpr.h:154
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecSVecCrossExpr.h:118
VT1::ElementType ET1
Element type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:96
Constraint on the data type.
Base template for the CrossTrait class.
Definition: CrossTrait.h:110
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
Constraint on the transpose flag of vector types.
Header file for the MultExprTrait class template.
SVecSVecCrossExpr< VT1, VT2 > This
Type of this SVecSVecCrossExpr instance.
Definition: SVecSVecCrossExpr.h:116
VT1::ReturnType RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:92
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.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecSVecCrossExpr.h:122
#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 DVecDVecCrossExpr< T1, T2 > operator%(const DenseVector< T1, false > &lhs, const DenseVector< T2, false > &rhs)
Operator for the cross product of two dense vectors ( ).
Definition: DVecDVecCrossExpr.h:466
VT2::ElementType ET2
Element type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:97
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
#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
VT1::CompositeType CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:94
Evaluation of the return type of a subtraction expression.Via this type trait it is possible to evalu...
Definition: SubExprTrait.h:104
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecSVecCrossExpr.h:245
Header file for the SelectType class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
VT1::ResultType RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:90
Header file for the serial shim.
Header file for the CrossExpr base class.
SubExprTrait< typename MultExprTrait< RN1, RN2 >::Type, typename MultExprTrait< RN1, RN2 >::Type >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecSVecCrossExpr.h:111
Header file for all forward declarations for dense vectors and matrices.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecSVecCrossExpr.h:233
Header file for run time assertion macros.
Header file for the cross product trait.
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: SVecSVecCrossExpr.h:221
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecSVecCrossExpr.h:119
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: SVecSVecCrossExpr.h:169
LeftOperand lhs_
Left-hand side sparse vector of the cross product expression.
Definition: SVecSVecCrossExpr.h:252
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: SVecSVecCrossExpr.h:188
CrossTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: SVecSVecCrossExpr.h:117
#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
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:128
VT2::CompositeType CT2
Composite type of the right-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:95
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecSVecCrossExpr.h:125
Header file for the IsComputation type trait class.
RightOperand rhs_
Right-hand side sparse vector of the cross product expression.
Definition: SVecSVecCrossExpr.h:253
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
const StaticVector< ET1, 3UL, false > LT
Composite type of the left-hand side sparse vector expression.
Definition: SVecSVecCrossExpr.h:134
Header file for exception macros.
Header file for the SubExprTrait class template.
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: SVecSVecCrossExpr.h:211
Header file for the Size type trait.
Evaluation of the resulting expression type of a multiplication.Via this type trait it is possible to...
Definition: MultExprTrait.h:137
#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
Expression object for sparse vector-sparse vector cross products.The SVecSVecCrossExpr class represen...
Definition: Forward.h:131
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.