26inline T
simdDot(
const T *CORRELATION_RESTRICT input_a,
const T *CORRELATION_RESTRICT input_b,
27 std::size_t count)
noexcept {
28#ifdef CORRELATION_SIMD_AVX512
29 return detail::avx512::simdDot(input_a, input_b, count);
30#elifdef CORRELATION_SIMD_AVX2
42inline void dotBlock(T v1x, T v1y, T v1z,
const T *CORRELATION_RESTRICT v2x,
43 const T *CORRELATION_RESTRICT v2y,
const T *CORRELATION_RESTRICT v2z,
44 T *CORRELATION_RESTRICT out_dot, std::size_t count)
noexcept {
45#ifdef CORRELATION_SIMD_AVX512
46 detail::avx512::dotBlock(v1x, v1y, v1z, v2x, v2y, v2z, out_dot, count);
47#elifdef CORRELATION_SIMD_AVX2
59inline T
debyeSum(T q_magnitude,
const T *CORRELATION_RESTRICT distances,
60 T *CORRELATION_RESTRICT scratch, std::size_t count)
noexcept {
61#ifdef CORRELATION_SIMD_AVX512
62 return detail::avx512::debyeSum(q_magnitude, distances, scratch, count);
63#elifdef CORRELATION_SIMD_AVX2
75inline void complexExpSum(T q_x, T q_y, T q_z,
const T *CORRELATION_RESTRICT x_s,
76 const T *CORRELATION_RESTRICT y_s,
const T *CORRELATION_RESTRICT z_s,
78 result.cos_sum =
static_cast<T
>(0.0);
79 result.sin_sum =
static_cast<T
>(0.0);
80 for (std::size_t idx = 0; idx < count; ++idx) {
81 const T phase = q_x * x_s[idx] + q_y * y_s[idx] + q_z * z_s[idx];
82 result.cos_sum += std::cos(phase);
83 result.sin_sum += std::sin(phase);
90 complexExpSum(params.q_x, params.q_y, params.q_z, params.x_s, params.y_s, params.z_s,
91 params.count, result);
94template <
typename T = real_t>
96 const T *CORRELATION_RESTRICT y_s,
97 const T *CORRELATION_RESTRICT z_s,
98 std::size_t count)
noexcept {
104template <
typename T = real_t>
118#ifdef CORRELATION_SIMD_AVX512
119 detail::avx512::millerPhaseSum(params, result);
120#elifdef CORRELATION_SIMD_AVX2
127template <
typename T = real_t>
135inline void millerPhaseSum(
const T *CORRELATION_RESTRICT cos1,
const T *CORRELATION_RESTRICT sin1,
136 const T *CORRELATION_RESTRICT cos2,
const T *CORRELATION_RESTRICT sin2,
137 const T *CORRELATION_RESTRICT cos3,
const T *CORRELATION_RESTRICT sin3,
152template <
typename T = real_t>
154millerPhaseSum(
const T *CORRELATION_RESTRICT cos1,
const T *CORRELATION_RESTRICT sin1,
155 const T *CORRELATION_RESTRICT cos2,
const T *CORRELATION_RESTRICT sin2,
156 const T *CORRELATION_RESTRICT cos3,
const T *CORRELATION_RESTRICT sin3,
157 std::size_t count)
noexcept {
159 millerPhaseSum(cos1, sin1, cos2, sin2, cos3, sin3, count, result);
Low-level AVX2 intrinsic kernel implementations.
Low-level AVX-512 intrinsic kernel implementations.
Common parameter containers, POD types, and scalar helpers for SIMD operations.
Low-level Scalar fallback kernel implementations.
void millerPhaseSum(const MillerPhaseSumParams< double > ¶ms, MillerPhaseSumResult< double > &result) noexcept
Definition AVX2Kernels.hpp:375
void dotBlock(double v1x, double v1y, double v1z, const double *v2x, const double *v2y, const double *v2z, double *out_dot, std::size_t count) noexcept
Definition AVX2Kernels.hpp:145
double debyeSum(double q_magnitude, const double *distances, double *scratch, std::size_t count) noexcept
Definition AVX2Kernels.hpp:211
double simdDot(const double *input_a, const double *input_b, std::size_t count) noexcept
Definition AVX2Kernels.hpp:93
double debyeSum(double q_magnitude, const double *distances, double *scratch, std::size_t count) noexcept
Definition ScalarKernels.hpp:106
void dotBlock(double v1x, double v1y, double v1z, const double *v2x, const double *v2y, const double *v2z, double *out_dot, std::size_t count) noexcept
Definition ScalarKernels.hpp:76
double simdDot(const double *input_a, const double *input_b, std::size_t count) noexcept
Definition ScalarKernels.hpp:53
void millerPhaseSum(const MillerPhaseSumParams< double > ¶ms, MillerPhaseSumResult< double > &result) noexcept
Definition ScalarKernels.hpp:203
Defines universal mathematical and physical constants.
MillerExpSumParams< T > ComplexExpSumParams
Alias for MillerExpSumParams used with complexExpSum kernel invocations.
Definition SIMDTypes.hpp:123
T simdDot(const T *input_a, const T *input_b, std::size_t count) noexcept
Computes the dot product of two array buffers.
Definition SIMDScattering.hpp:26
void dotBlock(T v1x, T v1y, T v1z, const T *v2x, const T *v2y, const T *v2z, T *out_dot, std::size_t count) noexcept
Computes dot products between a reference vector and a block of target vectors.
Definition SIMDScattering.hpp:42
void millerPhaseSum(const MillerPhaseSumParams< T > ¶ms, MillerPhaseSumResult< T > &result) noexcept
Computes the Miller phase sum across angle blocks.
Definition SIMDScattering.hpp:116
void complexExpSum(T q_x, T q_y, T q_z, const T *x_s, const T *y_s, const T *z_s, std::size_t count, ComplexExpSumResult< T > &result) noexcept
Computes the sum of complex exponentials for a query q-vector.
Definition SIMDScattering.hpp:75
T debyeSum(T q_magnitude, const T *distances, T *scratch, std::size_t count) noexcept
Computes the Debye scattering equation sum across distances.
Definition SIMDScattering.hpp:59
ComplexExpSumResult< T > MillerPhaseSumResult
Alias for MillerPhaseSumResult used with millerPhaseSum kernel invocations.
Definition SIMDTypes.hpp:138
Output result container holding cosine and sine phase sums.
Definition SIMDTypes.hpp:129
Parameter container for millerExpSum / complexExpSum kernel invocations.
Definition SIMDTypes.hpp:112
Parameter container for millerPhaseSum kernel invocations.
Definition SIMDTypes.hpp:98