35#ifndef _BLAZE_MATH_EXPRESSIONS_DVECDVECCROSSEXPR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DVECDVECCROSSEXPR_H_
88 :
public CrossExpr< DenseVector< DVecDVecCrossExpr<VT1,VT2,TF>, TF > >
110 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
114 ( std::declval<RN1>() * std::declval<RN2>() ) );
272 inline auto load() const noexcept {
276 return setall( x[1UL] * y[2UL] - x[2UL] * y[1UL]
277 , x[2UL] * y[0UL] - x[0UL] * y[2UL]
278 , x[0UL] * y[1UL] - x[1UL] * y[0UL] );
438 else if( index == 1UL )
456 return (*
this)[index];
470 return setall( x[1UL] * y[2UL] - x[2UL] * y[1UL]
471 , x[2UL] * y[0UL] - x[0UL] * y[2UL]
472 , x[0UL] * y[1UL] - x[1UL] * y[0UL] );
501 constexpr size_t size() const noexcept {
532 template<
typename T >
533 inline bool canAlias(
const T* alias )
const noexcept {
534 return (
lhs_.canAlias( alias ) ||
rhs_.canAlias( alias ) );
544 template<
typename T >
545 inline bool isAliased(
const T* alias )
const noexcept {
546 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
568 template<
typename VT >
579 (*lhs)[0] = x[1UL]*y[2UL] - x[2UL]*y[1UL];
580 (*lhs)[1] = x[2UL]*y[0UL] - x[0UL]*y[2UL];
581 (*lhs)[2] = x[0UL]*y[1UL] - x[1UL]*y[0UL];
598 template<
typename VT >
628 template<
typename VT >
629 friend inline void addAssign( DenseVector<VT,TF>& lhs,
const DVecDVecCrossExpr& rhs )
639 (*lhs)[0] += x[1UL]*y[2UL] - x[2UL]*y[1UL];
640 (*lhs)[1] += x[2UL]*y[0UL] - x[0UL]*y[2UL];
641 (*lhs)[2] += x[0UL]*y[1UL] - x[1UL]*y[0UL];
662 template<
typename VT >
663 friend inline void subAssign( DenseVector<VT,TF>& lhs,
const DVecDVecCrossExpr& rhs )
673 (*lhs)[0] -= x[1UL]*y[2UL] - x[2UL]*y[1UL];
674 (*lhs)[1] -= x[2UL]*y[0UL] - x[0UL]*y[2UL];
675 (*lhs)[2] -= x[0UL]*y[1UL] - x[1UL]*y[0UL];
696 template<
typename VT >
697 friend inline void multAssign( DenseVector<VT,TF>& lhs,
const DVecDVecCrossExpr& rhs )
707 (*lhs)[0] *= x[1UL]*y[2UL] - x[2UL]*y[1UL];
708 (*lhs)[1] *= x[2UL]*y[0UL] - x[0UL]*y[2UL];
709 (*lhs)[2] *= x[0UL]*y[1UL] - x[1UL]*y[0UL];
730 template<
typename VT >
731 friend inline void divAssign( DenseVector<VT,TF>& lhs,
const DVecDVecCrossExpr& rhs )
741 (*lhs)[0] /= x[1UL]*y[2UL] - x[2UL]*y[1UL];
742 (*lhs)[1] /= x[2UL]*y[0UL] - x[0UL]*y[2UL];
743 (*lhs)[2] /= x[0UL]*y[1UL] - x[1UL]*y[0UL];
797template<
typename VT1
805 if( (*lhs).size() != 3UL || (*rhs).size() != 3UL ) {
810 return ReturnType( *lhs, *rhs );
825template<
typename VT1,
typename VT2,
bool TF >
826struct IsPadded< DVecDVecCrossExpr<VT1,VT2,TF> >
827 :
public BoolConstant< DVecDVecCrossExpr<VT1,VT2,TF>::simdEnabled >
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.
Constraint on the transpose flag of vector types.
Header file for the cross product trait.
Header file for the function trace functionality.
Header file for the If class template.
Header file for the IsComputation type trait class.
Header file for the IsExpression type trait class.
Header file for the IsPadded type trait.
Header file for the IsTemporary type trait class.
Deactivation of problematic macros.
Header file for all SIMD functionality.
Iterator over the elements of the dense vector.
Definition: DVecDVecCrossExpr.h:154
BLAZE_DEVICE_CALLABLE ConstIterator & operator++()
Pre-increment operator.
Definition: DVecDVecCrossExpr.h:214
BLAZE_DEVICE_CALLABLE ReturnType operator*() const
Direct access to the element at the current iterator position.
Definition: DVecDVecCrossExpr.h:256
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(const ConstIterator &it, size_t inc)
Addition between a ConstIterator and an integral value.
Definition: DVecDVecCrossExpr.h:366
ElementType * PointerType
Pointer return type.
Definition: DVecDVecCrossExpr.h:159
auto load() const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecCrossExpr.h:272
BLAZE_DEVICE_CALLABLE bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:299
IteratorCategory iterator_category
The iterator category.
Definition: DVecDVecCrossExpr.h:164
size_t index_
Index to the current element of the cross product.
Definition: DVecDVecCrossExpr.h:399
BLAZE_DEVICE_CALLABLE bool operator<(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:310
BLAZE_DEVICE_CALLABLE ConstIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DVecDVecCrossExpr.h:203
ValueType value_type
Type of the underlying elements.
Definition: DVecDVecCrossExpr.h:165
ReferenceType reference
Reference return type.
Definition: DVecDVecCrossExpr.h:167
BLAZE_DEVICE_CALLABLE ConstIterator(const LeftOperand &left, const RightOperand &right, size_t index)
Constructor for the ConstIterator class.
Definition: DVecDVecCrossExpr.h:178
BLAZE_DEVICE_CALLABLE DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DVecDVecCrossExpr.h:354
BLAZE_DEVICE_CALLABLE bool operator>(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:321
ElementType & ReferenceType
Reference return type.
Definition: DVecDVecCrossExpr.h:160
BLAZE_DEVICE_CALLABLE bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:288
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator+(size_t inc, const ConstIterator &it)
Addition between an integral value and a ConstIterator.
Definition: DVecDVecCrossExpr.h:378
ElementType ValueType
Type of the underlying elements.
Definition: DVecDVecCrossExpr.h:158
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: DVecDVecCrossExpr.h:161
BLAZE_DEVICE_CALLABLE const ConstIterator operator++(int)
Post-increment operator.
Definition: DVecDVecCrossExpr.h:225
std::random_access_iterator_tag IteratorCategory
The iterator category.
Definition: DVecDVecCrossExpr.h:157
BLAZE_DEVICE_CALLABLE ConstIterator & operator--()
Pre-decrement operator.
Definition: DVecDVecCrossExpr.h:235
DifferenceType difference_type
Difference between two iterators.
Definition: DVecDVecCrossExpr.h:168
BLAZE_DEVICE_CALLABLE ConstIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DVecDVecCrossExpr.h:191
const LeftOperand & left_
Iterator to the current left-hand side element.
Definition: DVecDVecCrossExpr.h:397
const RightOperand & right_
Iterator to the current right-hand side element.
Definition: DVecDVecCrossExpr.h:398
friend BLAZE_DEVICE_CALLABLE const ConstIterator operator-(const ConstIterator &it, size_t dec)
Subtraction between a ConstIterator and an integral value.
Definition: DVecDVecCrossExpr.h:390
BLAZE_DEVICE_CALLABLE const ConstIterator operator--(int)
Post-decrement operator.
Definition: DVecDVecCrossExpr.h:246
BLAZE_DEVICE_CALLABLE bool operator<=(const ConstIterator &rhs) const
Less-than comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:332
PointerType pointer
Pointer return type.
Definition: DVecDVecCrossExpr.h:166
BLAZE_DEVICE_CALLABLE bool operator>=(const ConstIterator &rhs) const
Greater-than comparison between two ConstIterator objects.
Definition: DVecDVecCrossExpr.h:343
Expression object for dense vector-dense vector cross products.
Definition: DVecDVecCrossExpr.h:90
If_t< IsComputation_v< VT1 >, const StaticVector< ET1, 3UL, TF >, CT1 > LT
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:144
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: DVecDVecCrossExpr.h:110
ConstIterator begin() const
Returns an iterator to the first non-zero element of the dense vector.
Definition: DVecDVecCrossExpr.h:481
decltype((std::declval< RN1 >() *std::declval< RN2 >()) -(std::declval< RN1 >() *std::declval< RN2 >())) ExprReturnType
Expression return type for the subscript operator.
Definition: DVecDVecCrossExpr.h:114
BLAZE_ALWAYS_INLINE auto load(size_t index) const noexcept
Access to the SIMD elements of the vector.
Definition: DVecDVecCrossExpr.h:466
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: DVecDVecCrossExpr.h:127
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DVecDVecCrossExpr.h:409
ReturnType at(size_t index) const
Checked access to the vector elements.
Definition: DVecDVecCrossExpr.h:452
ReturnType_t< VT2 > RN2
Return type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:96
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DVecDVecCrossExpr.h:533
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DVecDVecCrossExpr.h:545
If_t< IsComputation_v< VT2 >, const StaticVector< ET2, 3UL, TF >, CT2 > RT
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:147
constexpr size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DVecDVecCrossExpr.h:501
LeftOperand leftOperand() const noexcept
Returns the left-hand side dense vector operand.
Definition: DVecDVecCrossExpr.h:511
ReturnType_t< VT1 > RN1
Return type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:95
CompositeType_t< VT1 > CT1
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:97
ElementType_t< VT1 > ET1
Element type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:99
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DVecDVecCrossExpr.h:406
If_t< IsExpression_v< VT2 >, const VT2, const VT2 & > RightOperand
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:141
LeftOperand lhs_
Left-hand side dense vector of the cross product expression.
Definition: DVecDVecCrossExpr.h:552
If_t< IsExpression_v< VT1 >, const VT1, const VT1 & > LeftOperand
Composite type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:138
RightOperand rhs_
Right-hand side dense vector of the cross product expression.
Definition: DVecDVecCrossExpr.h:553
DVecDVecCrossExpr(const VT1 &lhs, const VT2 &rhs) noexcept
Constructor for the DVecDVecCrossExpr class.
Definition: DVecDVecCrossExpr.h:418
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DVecDVecCrossExpr.h:126
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: DVecDVecCrossExpr.h:130
ResultType_t< VT1 > RT1
Result type of the left-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:93
CompositeType_t< VT2 > CT2
Composite type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:98
ReturnType operator[](size_t index) const
Subscript operator for the direct access to the vector elements.
Definition: DVecDVecCrossExpr.h:433
ElementType_t< VT2 > ET2
Element type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:100
CrossTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: DVecDVecCrossExpr.h:125
If_t< !RequiresEvaluation_v< VT1 > &&!RequiresEvaluation_v< VT2 >, const DVecDVecCrossExpr &, const ResultType > CompositeType
Data type for composite expression templates.
Definition: DVecDVecCrossExpr.h:135
ResultType_t< VT2 > RT2
Result type of the right-hand side dense vector expression.
Definition: DVecDVecCrossExpr.h:94
ConstIterator end() const
Returns an iterator just past the last non-zero element of the dense vector.
Definition: DVecDVecCrossExpr.h:491
RightOperand rightOperand() const noexcept
Returns the right-hand side dense vector operand.
Definition: DVecDVecCrossExpr.h:521
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse vectors.
Definition: SparseVector.h:72
Efficient implementation of a fixed-sized vector.
Definition: StaticVector.h:230
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the CrossExpr base class.
Header file for the DenseVector 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_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.
Definition: CrossTrait.h:138
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > setall(T v0, Ts... vs) noexcept
Sets all values in a SIMD vector to the given 1-byte integral values.
Definition: Setall.h:153
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#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 dense vectors and matrices.
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 cross product expression templates.
Definition: CrossExpr.h:68
Header file for basic type definitions.