GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
DistanceHwy.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
// Highway SIMD-accelerated inner kernels for Distance::dist_at().
6
//
7
// These functions vectorize the innermost (n,m) accumulation loop:
8
// dist(n,m) += two_s2 * (invr_ij_1 - invr2[m])^2
9
//
10
// The scalar fallback uses Eigen; the SIMD path uses Highway for portable
11
// AVX2/AVX-512/NEON acceleration on the pre-computed invr2 vector.
12
13
#ifndef GPR_AUXILIARY_DISTANCE_HWY_H_
14
#define GPR_AUXILIARY_DISTANCE_HWY_H_
15
16
#ifdef USE_HIGHWAY
17
18
#include <hwy/highway.h>
19
20
namespace
gpr
{
21
namespace
hwy_kernels {
22
23
// Accumulate squared differences into dist row:
24
// dist[m] += scale * (broadcast_val - src[m])^2
25
// for m in [0, count).
26
HWY_ATTR
void
accumulate_invr_diff_sq(
double
* HWY_RESTRICT dist,
27
const
double
* HWY_RESTRICT src,
28
double
broadcast_val,
double
scale,
29
int64_t count);
30
31
// In-place inverse square root over a contiguous batch: r2[i] <- 1/sqrt(r2[i]).
32
// dist_at computes one of these per (atom pair, configuration) and did it
33
// scalar, which is the expensive part of the distance assembly. Bit-identical
34
// to 1.0/std::sqrt: IEEE-754 requires both sqrt and divide to be correctly
35
// rounded, so vsqrtpd/vdivpd and the scalar forms agree exactly, and the
36
// result does not depend on how many elements are in the batch.
37
HWY_ATTR
void
recip_sqrt_inplace(
double
* HWY_RESTRICT r2, int64_t count);
38
39
}
// namespace hwy_kernels
40
}
// namespace gpr
41
42
#endif
// USE_HIGHWAY
43
#endif
// GPR_AUXILIARY_DISTANCE_HWY_H_
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
gpr
auxiliary
DistanceHwy.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf