23namespace vctr::expressions
26template <
size_t extent,
class SrcAType,
class SrcBType>
31 using value_type = std::conditional_t<std::integral<CommonType>, double, CommonType>;
33 VCTR_COMMON_BINARY_VEC_VEC_EXPRESSION_MEMBERS (
PowVectors, srcBase, srcExp)
35 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
40 if (std::is_constant_evaluated())
41 return value_type (gcem::pow (srcBase[i], srcExp[i]));
45 return value_type (std::pow (srcBase[i], srcExp[i]));
48 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
51 Expression::Accelerate::pow (srcBase.evalNextVectorOpInExpressionChain (dst), srcExp.evalNextVectorOpInExpressionChain (dst), dst,
sizeToInt (size()));
55 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
58 Expression::IPP::pow (srcBase.evalNextVectorOpInExpressionChain (dst), srcExp.evalNextVectorOpInExpressionChain (dst), dst,
sizeToInt (size()));
63 VCTR_FORWARD_PREPARE_SIMD_EVALUATION_BINARY_EXPRESSION_MEMBER_FUNCTIONS (srcBase, srcExp)
69 return { vpowf (srcBase.getSSE (i).value, srcExp.getSSE (i).value) };
75 return { vpowf (srcBase.getNeon (i).value, srcExp.getNeon (i).value) };
79template <
size_t extent,
class SrcType>
83 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
87 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
92 if (std::is_constant_evaluated())
93 return value_type (gcem::pow (base[i],
exp));
97 return value_type (std::pow (base[i],
exp));
100 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
103 Expression::IPP::pow (base.evalNextVectorOpInExpressionChain (dst),
exp, dst,
sizeToInt (size()));
108template <
size_t extent,
class SrcType>
112 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
116 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
121 if (std::is_constant_evaluated())
122 return value_type (gcem::pow (base,
exp[i]));
126 return value_type (std::pow (base,
exp[i]));
130template <
size_t extent,
class SrcType, is::constant ConstantType>
134 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
136 static constexpr value_type exp = ConstantType::value;
140 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
145 if (std::is_constant_evaluated())
146 return value_type (gcem::pow (src[i],
exp));
150 return value_type (std::pow (src[i],
exp));
153 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
156 Expression::IPP::pow (src.evalNextVectorOpInExpressionChain (dst),
exp, dst,
sizeToInt (size()));
161template <
size_t extent,
class SrcType, is::constant ConstantType>
165 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
167 static constexpr value_type base = ConstantType::value;
171 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
176 if (std::is_constant_evaluated())
177 return value_type (gcem::pow (base, src[i]));
181 return value_type (std::pow (base, src[i]));
186 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
193 const auto s = size();
194 const auto* x = src.evalNextVectorOpInExpressionChain (dst);
196 for (
size_t i = 0; i < s; ++i)
197 dst[i] = std::pow (base, x[i]);
212 template <is::anyVctrOrExpression SrcBaseType, is::anyVctrOrExpression SrcExpType>
213 constexpr auto pow (SrcBaseType&& bases, SrcExpType&& exponents)
216 constexpr auto extent = getCommonExtent<SrcBaseType, SrcExpType>();
225template <is::anyVctrOrExpression Src>
226constexpr auto pow (
typename std::remove_cvref_t<Src>::value_type base, Src&& exponents)
241template <is::anyVctrOrExpression Src>
242constexpr auto pow (Src&& bases,
typename std::remove_cvref_t<Src>::value_type exponent)
258template <auto exponent>
Constrains a type to represent a complex valued floating point number (e.g.
Definition: NumericTypeConcepts.h:87
A combined concept to check if Apple Accelerate vpf functions are suitable to work on Neon registers.
Definition: ContainerAndExpressionConcepts.h:256
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:321
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:260
A combined concept to check if Apple Accelerate vpf functions are suitable to work on SSE registers.
Definition: ContainerAndExpressionConcepts.h:252
A combined concept to check if Intel IPP is a suitable option for a real valued floating point vector...
Definition: ContainerAndExpressionConcepts.h:284
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:342
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:296
constexpr ExpressionChainBuilder< expressions::Exp > exp
Computes e (Euler's number, 2.7182818...) raised to the source vector elements power.
Definition: Exp.h:84
constexpr ExpressionChainBuilder< expressions::PowConstantBase, Constant< base > > powConstantBase
Evaluates base raised to the power of the source elements.
Definition: Pow.h:252
constexpr auto pow(SrcBaseType &&bases, SrcExpType &&exponents)
Returns an expression that raises the elements in bases element-wise to the power of the elements in ...
Definition: Pow.h:213
constexpr ExpressionChainBuilder< expressions::PowConstantExponent, Constant< exponent > > powConstantExponent
Evaluates the source elements raised to the power of exponent.
Definition: Pow.h:259
The main namespace of the VCTR project.
Definition: Array.h:24
constexpr void assertCommonSize(const A &a, const B &b)
Ensures that both sources have the same size.
Definition: Traits.h:256
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
int sizeToInt(size_t size)
Casts the size_t argument to an int.
Definition: PlatformVectorOpsHelpers.h:27
An expression chain builder is an object which supplies various operator<< overloads which build chai...
Definition: ExpressionChainBuilder.h:157
The base class to every expression template.
Definition: ExpressionTemplate.h:37
Definition: NeonRegister.h:28
Definition: SSERegister.h:28