23namespace vctr::expressions
26template <
size_t extent,
class SrcType>
27requires is::realFloatNumber<ValueType<SrcType>> || is::complexFloatNumber<ValueType<SrcType>>
33 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (
Sqrt, src)
35 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
37 VCTR_ASSERT (inputValueValid (src[i]));
41 if (std::is_constant_evaluated())
42 return gcem::sqrt (src[i]);
46 return std::sqrt (src[i]);
51 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
54 const auto* s = src.evalNextVectorOpInExpressionChain (dst);
55 VCTR_ASSERT (std::all_of (s, s + size(), inputValueValid));
57 Expression::Accelerate::sqrt (s, dst,
sizeToInt (size()));
61 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
64 const auto* s = src.evalNextVectorOpInExpressionChain (dst);
65 VCTR_ASSERT (std::all_of (s, s + size(), inputValueValid));
67 Expression::IPP::sqrt (s, dst,
sizeToInt (size()));
73 static constexpr bool inputValueValid (value_type in)
76 return in >= value_type (0);
Constrains a type to represent a real valued floating point number.
Definition: NumericTypeConcepts.h:83
Constrains a type to represent a real valued 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:291
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:327
constexpr ExpressionChainBuilder< expressions::Sqrt > sqrt
Computes the square root of the source values.
Definition: Sqrt.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:170
The base class to every expression template.
Definition: ExpressionTemplate.h:37