Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
beta_avx2.cpp File Reference

AVX2 (256-bit, 4-wide) implementation of the beta batch kernel. More...

#include "simd_batch_detail.hpp"
#include "momentum/momentum.hpp"
#include <immintrin.h>
#include <cmath>
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  srfm
 
namespace  srfm::simd
 
namespace  srfm::simd::detail
 

Functions

static double srfm::simd::detail::hmax_pd_avx2 (__m256d v) noexcept
 
void srfm::simd::detail::compute_beta_avx2 (const double *__restrict__ velocities, std::size_t n, double &running_max, double *__restrict__ out) noexcept
 AVX2 (256-bit, 4-wide) beta batch kernel.
 

Variables

static constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
 
static constexpr std::uint64_t srfm::simd::detail::ABS_MASK_U64 = 0x7FFF'FFFF'FFFF'FFFFu
 

Detailed Description

AVX2 (256-bit, 4-wide) implementation of the beta batch kernel.

Module: src/simd/ Owner: AGT-08 — 2026-03-01

Algorithm: Batch-max (4-wide SIMD)

  1. Pass 1 (vectorised): compute batch_max using 4-wide SIMD abs + hmax.
  2. Update scalar running_max.
  3. Pass 2 (vectorised): broadcast running_max, divide |v_i| by it, clamp.
  4. Tail (scalar): handle n % 4 remaining elements.

Correctness guarantee: produces bit-identical results to compute_beta_scalar() for any input, because both use the same batch_max before dividing.

Note: Compiled with -mavx2 / /arch:AVX2.

Definition in file beta_avx2.cpp.