23namespace vctr::expressions
26template <
size_t extent,
class SrcType>
27requires is::number<ValueType<SrcType>>
33 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (
Product, src)
35 static constexpr value_type reductionResultInitValue = 1;
37 VCTR_FORCEDINLINE
constexpr void reduceElementWise (value_type& result,
size_t i)
const
41 if (std::is_constant_evaluated())
44 const auto rhs = src[i];
45 const auto a = result.real();
46 const auto b = result.imag();
47 const auto c = rhs.real();
48 const auto d = rhs.imag();
49 result = value_type (a * c - b * d, a * d + b * c);
58 VCTR_FORWARD_PREPARE_SIMD_EVALUATION_UNARY_EXPRESSION_MEMBER_FUNCTIONS
63 result = Expression::Neon::mul (result, src.getNeon (i));
66 VCTR_FORCEDINLINE VCTR_TARGET (
"fma")
void reduceAVXRegisterWise (
AVXRegister<value_type>& result,
size_t i)
const
69 result = Expression::AVX::mul (result, src.getAVX (i));
72 VCTR_FORCEDINLINE VCTR_TARGET (
"sse4.1")
void reduceSSERegisterWise (
SSERegister<value_type>& result,
size_t i)
const
75 result = Expression::SSE::mul (result, src.getSSE (i));
80 VCTR_FORCEDINLINE
static constexpr value_type finalizeReduction (
const std::array<value_type, n>& products)
85 return std::reduce (products.begin(), products.end(), reductionResultInitValue, std::multiplies<>());
Constrains a type to have a member function getAVX (size_t) const.
Definition: ContainerAndExpressionConcepts.h:98
Constrains a type to have a member function getNeon (size_t) const.
Definition: ContainerAndExpressionConcepts.h:90
Constrains a type to have a member function getSSE (size_t) const.
Definition: ContainerAndExpressionConcepts.h:106
Constrains a type to represent a complex valued floating point number (e.g.
Definition: NumericTypeConcepts.h:91
Constrains a type to represent a real valued 32 bit integer number.
Definition: NumericTypeConcepts.h:61
Constrains a type to represent a real valued floating point number.
Definition: NumericTypeConcepts.h:87
constexpr ExpressionChainBuilder< expressions::Product > product
Computes the product of the source values.
Definition: Product.h:102
The main namespace of the VCTR project.
Definition: Array.h:24
typename detail::ValueType< std::remove_cvref_t< T > >::Type ValueType
If T is an expression template, it equals its return type, if it's a type that defines value_type as ...
Definition: Traits.h:201
Definition: AVXRegister.h:28
An expression chain builder is an object which supplies various operator<< overloads which build chai...
Definition: ExpressionChainBuilder.h:170
The base class to every expression template.
Definition: ExpressionTemplate.h:37
Definition: NeonRegister.h:28
Definition: SSERegister.h:28