47 double batch_max = 0.0;
48 for (std::size_t i = 0; i < n; ++i) {
49 const double abs_v = std::abs(velocities[i]);
50 if (abs_v > batch_max) batch_max = abs_v;
54 if (batch_max > running_max) running_max = batch_max;
58 const double denom = (running_max > 0.0) ? running_max : 1.0;
59 for (std::size_t i = 0; i < n; ++i) {
60 const double abs_v = std::abs(velocities[i]);
61 double beta = abs_v / denom;
void compute_beta_scalar(const double *__restrict__ velocities, std::size_t n, double &running_max, double *__restrict__ out) noexcept
Scalar reference implementation of the beta batch kernel.