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()));
67 return { vpowf (srcBase.getSSE (i).value, srcExp.getSSE (i).value) };
73 return { vpowf (srcBase.getNeon (i).value, srcExp.getNeon (i).value) };
77template <
size_t extent,
class SrcType>
81 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
85 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
90 if (std::is_constant_evaluated())
91 return value_type (gcem::pow (base[i],
exp));
95 return value_type (std::pow (base[i],
exp));
98 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
101 Expression::IPP::pow (base.evalNextVectorOpInExpressionChain (dst),
exp, dst,
sizeToInt (size()));
106template <
size_t extent,
class SrcType>
110 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
114 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
119 if (std::is_constant_evaluated())
120 return value_type (gcem::pow (base,
exp[i]));
124 return value_type (std::pow (base,
exp[i]));
128template <
size_t extent,
class SrcType, is::constant ConstantType>
132 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
134 static constexpr value_type exp = ConstantType::value;
138 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
143 if (std::is_constant_evaluated())
144 return value_type (gcem::pow (src[i],
exp));
148 return value_type (std::pow (src[i],
exp));
151 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
154 Expression::IPP::pow (src.evalNextVectorOpInExpressionChain (dst),
exp, dst,
sizeToInt (size()));
159template <
size_t extent,
class SrcType, is::constant ConstantType>
163 using value_type = std::conditional_t<std::is_integral_v<ValueType<SrcType>>, double,
ValueType<SrcType>>;
165 static constexpr value_type base = ConstantType::value;
169 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
174 if (std::is_constant_evaluated())
175 return value_type (gcem::pow (base, src[i]));
179 return value_type (std::pow (base, src[i]));
184 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
191 const auto s = size();
192 const auto* x = src.evalNextVectorOpInExpressionChain (dst);
194 for (
size_t i = 0; i < s; ++i)
195 dst[i] = std::pow (base, x[i]);
210 template <is::anyVctrOrExpression SrcBaseType, is::anyVctrOrExpression SrcExpType>
211 constexpr auto pow (SrcBaseType&& bases, SrcExpType&& exponents)
214 constexpr auto extent = getCommonExtent<SrcBaseType, SrcExpType>();
223template <is::anyVctrOrExpression Src>
224constexpr auto pow (
typename std::remove_cvref_t<Src>::value_type base, Src&& exponents)
239template <is::anyVctrOrExpression Src>
240constexpr auto pow (Src&& bases,
typename std::remove_cvref_t<Src>::value_type exponent)
256template <auto exponent>
Constrains a type to represent a complex valued floating point number (e.g.
Definition: NumericTypeConcepts.h:83
A combined concept to check if Apple Accelerate vpf functions are suitable to work on Neon registers.
Definition: ContainerAndExpressionConcepts.h:238
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:303
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:242
A combined concept to check if Apple Accelerate vpf functions are suitable to work on SSE registers.
Definition: ContainerAndExpressionConcepts.h:234
A combined concept to check if Intel IPP is a suitable option for a real valued floating point vector...
Definition: ContainerAndExpressionConcepts.h:266
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:324
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:278
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:250
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:211
constexpr ExpressionChainBuilder< expressions::PowConstantExponent, Constant< exponent > > powConstantExponent
Evaluates the source elements raised to the power of exponent.
Definition: Pow.h:257
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:253
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:136
The base class to every expression template.
Definition: ExpressionTemplate.h:37
Definition: NeonRegister.h:28
Definition: SSERegister.h:28