23namespace vctr::expressions
26template <
size_t extent,
class SrcType>
27requires is::realNumber<ValueType<SrcType>>
33 using value_type = std::conditional_t<is::intNumber<SrcValueType>, float, SrcValueType>;
35 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (
Log2, src)
37 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
40 if (std::is_constant_evaluated())
41 return value_type (gcem::log2 (src[i]));
44 return value_type (std::log2 (src[i]));
49 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
52 Expression::Accelerate::log2 (src.evalNextVectorOpInExpressionChain (dst), dst,
sizeToInt (size()));
56 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
61 Expression::Accelerate::intToFloat (src.evalNextVectorOpInExpressionChain (
reinterpret_cast<SrcValueType*
> (dst)), dst, s);
62 Expression::Accelerate::log2 (dst, dst,
sizeToInt (s));
67 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
71 constexpr auto factor = value_type (1.4426950408889634);
75 Expression::IPP::ln (src.evalNextVectorOpInExpressionChain (dst), dst, s);
76 Expression::IPP::mul (factor, dst, s);
Constrains a type to represent a real valued 32 bit integer number.
Definition: NumericTypeConcepts.h:53
Constrains a type to represent a real valued floating point number.
Definition: NumericTypeConcepts.h:79
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 is a suitable option for a vector operation that tran...
Definition: ContainerAndExpressionConcepts.h:258
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::Log2 > log2
Computes the logarithm to the base of two of the source values.
Definition: Log2.h:91
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
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