23namespace vctr::expressions
26template <
size_t extent,
class SrcType>
27requires is::realFloatNumber<ValueType<SrcType>>
35 constexpr void applyRuntimeArgs()
40 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
42 VCTR_ASSERT (srcSum != value_type (0));
43 VCTR_START_IGNORE_WARNING_MSVC (4723)
44 return src[i] / srcSum;
45 VCTR_END_IGNORE_WARNING_MSVC
50 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
53 VCTR_ASSERT (srcSum != value_type (0));
54 Expression::Accelerate::div (src.evalNextVectorOpInExpressionChain (dst), srcSum, dst, size());
58 VCTR_FORCEDINLINE
const value_type* evalNextVectorOpInExpressionChain (value_type* dst)
const
61 VCTR_ASSERT (srcSum != value_type (0));
62 Expression::IPP::div (src.evalNextVectorOpInExpressionChain (dst), srcSum, dst,
sizeToInt (size()));
68 VCTR_FORCEDINLINE VCTR_TARGET (
"avx")
void prepareAVXEvaluation()
const
71 src.prepareAVXEvaluation();
72 srcSumSIMD.avx = Expression::AVX::broadcast (srcSum);
78 using Reg =
typename Expression::AVX;
80 return Reg::div (src.getAVX (i), srcSumSIMD.avx);
83 VCTR_FORCEDINLINE VCTR_TARGET (
"sse4.1")
void prepareSSEEvaluation()
const
86 src.prepareSSEEvaluation();
87 srcSumSIMD.sse = Expression::SSE::broadcast (srcSum);
93 using Reg =
typename Expression::SSE;
95 return Reg::div (src.getSSE (i), srcSumSIMD.sse);
98 VCTR_FORCEDINLINE
void prepareNeonEvaluation()
const
101 src.prepareNeonEvaluation();
102 srcSumSIMD.neon = Expression::Neon::broadcast (srcSum);
108 using Reg =
typename Expression::Neon;
110 return Reg::div (src.getNeon (i), srcSumSIMD.neon);
115 value_type srcSum = value_type (0);
Definition: NormalizeSum.h:29
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 have a member function prepareAVXEvaluation() const.
Definition: ContainerAndExpressionConcepts.h:94
Constrains a type to have a member function prepareNeonEvaluation() const.
Definition: ContainerAndExpressionConcepts.h:86
Constrains a type to have a member function prepareSSEEvaluation() const.
Definition: ContainerAndExpressionConcepts.h:102
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:309
A combined concept to check if Intel IPP is a suitable option for a real valued floating point vector...
Definition: ContainerAndExpressionConcepts.h:337
constexpr ExpressionChainBuilder< expressions::NormalizeSum > normalizeSum
Computes the sum of the source elements and divides all source elements by that sum.
Definition: NormalizeSum.h:137
constexpr ExpressionChainBuilder< expressions::Sum > sum
Computes the sum of the source values.
Definition: Sum.h:118
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
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
Helper template to define a union of all supported SIMD types.
Definition: ExpressionTemplate.h:123