23namespace vctr::expressions
26template <
size_t extent,
class SrcType>
32 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (
Abs, src)
34 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
40 if (std::is_constant_evaluated())
43 return gcem::abs (value);
45 return gcem::sqrt (value.real() * value.real() + value.imag() * value.imag());
49 return std::abs (value);
52 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
59 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
60 requires is::suitableForAccelerateRealFloatVectorOp <SrcType, value_type, detail::dontPreferIfIppAndAccelerateAreAvailable> ||
64 Expression::Accelerate::abs (src.evalNextVectorOpInExpressionChain (dst), dst, size());
69 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
70 requires is::suitableForIppRealSingedInt32VectorOp <SrcType, value_type, detail::preferIfIppAndAccelerateAreAvailable> ||
71 is::suitableForIppRealFloatVectorOp <SrcType, value_type, detail::preferIfIppAndAccelerateAreAvailable> ||
75 Expression::IPP::abs (src.evalNextVectorOpInExpressionChain (dst), dst,
sizeToInt (size()));
80 VCTR_FORWARD_PREPARE_SIMD_EVALUATION_UNARY_EXPRESSION_MEMBER_FUNCTIONS
85 return Expression::Neon::abs (src.getNeon (i));
91 return src.getNeon (i);
98 static const auto avxSignBit = Expression::AVX::broadcast (
typename Expression::CommonElement::Type (-0.0));
100 return Expression::AVX::bitwiseAndNot (src.getAVX (i), avxSignBit);
106 return Expression::AVX::abs (src.getAVX (i));
112 return src.getAVX (i);
119 static const auto sseSignBit = Expression::SSE::broadcast (
typename Expression::CommonElement::Type (-0.0));
121 return Expression::SSE::bitwiseAndNot (src.getSSE (i), sseSignBit);
127 return Expression::SSE::abs (src.getSSE (i));
133 return src.getSSE (i);
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 real valued number.
Definition: NumericTypeConcepts.h:83
Constrains a type to represent a real valued signed number (e.g.
Definition: NumericTypeConcepts.h:69
A combined concept to check if Apple Accelerate is a suitable option for a floating point vector oper...
Definition: ContainerAndExpressionConcepts.h:321
A combined concept to check if Intel IPP is a suitable option for a floating point vector operation t...
Definition: ContainerAndExpressionConcepts.h:353
Constrains a type to represent a real valued unsigned integer number.
Definition: NumericTypeConcepts.h:78
constexpr ExpressionChainBuilder< expressions::Abs > abs
Computes the absolute value of the source values.
Definition: Abs.h:147
The main namespace of the VCTR project.
Definition: Array.h:24
typename detail::RealType< std::remove_cvref_t< T > >::Type RealType
If T is any instance of std::complex, this will be the real value_type, otherwise this will be T.
Definition: Traits.h:211
int sizeToInt(size_t size)
Casts the size_t argument to an int.
Definition: PlatformVectorOpsHelpers.h:27
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