Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Functions | Variables
srfm::simd::detail Namespace Reference

Functions

static double hmax_pd_avx2 (__m256d v) noexcept
 
void 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.
 
void compute_beta_avx512 (const double *__restrict__ velocities, std::size_t n, double &running_max, double *__restrict__ out) noexcept
 AVX-512F (512-bit, 8-wide) beta batch kernel.
 
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.
 
void compute_gamma_avx2 (const double *__restrict__ betas, std::size_t n, double *__restrict__ out) noexcept
 AVX2 (256-bit, 4-wide) gamma batch kernel.
 
void compute_gamma_avx512 (const double *__restrict__ betas, std::size_t n, double *__restrict__ out) noexcept
 AVX-512F (512-bit, 8-wide) gamma batch kernel.
 
void compute_gamma_scalar (const double *__restrict__ betas, std::size_t n, double *__restrict__ out) noexcept
 Scalar reference implementation of the gamma batch kernel.
 
void cpuid (std::uint32_t leaf, std::uint32_t subleaf, std::uint32_t out[4]) noexcept
 
std::uint64_t xgetbv (std::uint32_t xcr) noexcept
 Read XCR0 (used to verify OS XSAVE support for YMM/ZMM state).
 
bool os_saves_ymm () noexcept
 Probe OS support for YMM (AVX) register save/restore.
 
bool os_saves_zmm () noexcept
 Probe OS support for ZMM (AVX-512) register save/restore.
 

Variables

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

Function Documentation

◆ compute_beta_avx2()

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.

Requires AVX2 support (detected at runtime). Falls back to scalar for tail elements when n % 4 != 0.

Definition at line 44 of file beta_avx2.cpp.

◆ compute_beta_avx512()

void srfm::simd::detail::compute_beta_avx512 ( const double *__restrict__  velocities,
std::size_t  n,
double &  running_max,
double *__restrict__  out 
)
noexcept

AVX-512F (512-bit, 8-wide) beta batch kernel.

Requires AVX-512F support (detected at runtime). Falls back to scalar for tail elements when n % 8 != 0.

Definition at line 33 of file beta_avx512.cpp.

◆ compute_beta_scalar()

void srfm::simd::detail::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.

Always available regardless of hardware. Used as the authoritative correctness reference and as the tail handler for wider kernels.

Parameters
velocitiesInput price velocities (any finite double).
nNumber of elements.
running_maxCurrent running maximum of |velocity|; updated in-place.
outOutput beta values, one per input velocity.

Definition at line 38 of file beta_scalar.cpp.

◆ compute_gamma_avx2()

void srfm::simd::detail::compute_gamma_avx2 ( const double *__restrict__  betas,
std::size_t  n,
double *__restrict__  out 
)
noexcept

AVX2 (256-bit, 4-wide) gamma batch kernel.

Definition at line 40 of file gamma_avx2.cpp.

◆ compute_gamma_avx512()

void srfm::simd::detail::compute_gamma_avx512 ( const double *__restrict__  betas,
std::size_t  n,
double *__restrict__  out 
)
noexcept

AVX-512F (512-bit, 8-wide) gamma batch kernel.

Definition at line 55 of file gamma_avx512.cpp.

◆ compute_gamma_scalar()

void srfm::simd::detail::compute_gamma_scalar ( const double *__restrict__  betas,
std::size_t  n,
double *__restrict__  out 
)
noexcept

Scalar reference implementation of the gamma batch kernel.

Computes gamma_i = 1.0 / sqrt(1.0 - betas[i]^2). Clamps betas[i] to BETA_CLAMP_SAFE before the sqrt to prevent NaN.

Parameters
betasInput beta values in [0, BETA_MAX_SAFE].
nNumber of elements.
outOutput gamma values, one per input beta.

Definition at line 33 of file gamma_scalar.cpp.

◆ cpuid()

void srfm::simd::detail::cpuid ( std::uint32_t  leaf,
std::uint32_t  subleaf,
std::uint32_t  out[4] 
)
inlinenoexcept

Thin portable wrapper around the CPUID instruction.

Parameters
leafEAX input (function).
subleafECX input (sub-function). 0 for most leaves.
outOutput array: [EAX, EBX, ECX, EDX].
Examples
/home/runner/work/Special-Relativity-in-Financial-Modeling/Special-Relativity-in-Financial-Modeling/include/srfm/simd/cpu_features.hpp.

Definition at line 74 of file cpu_features.hpp.

◆ hmax_pd_avx2()

static double srfm::simd::detail::hmax_pd_avx2 ( __m256d  v)
inlinestaticnoexcept

Definition at line 36 of file beta_avx2.cpp.

◆ os_saves_ymm()

bool srfm::simd::detail::os_saves_ymm ( )
inlinenoexcept

◆ os_saves_zmm()

bool srfm::simd::detail::os_saves_zmm ( )
inlinenoexcept

◆ xgetbv()

std::uint64_t srfm::simd::detail::xgetbv ( std::uint32_t  xcr)
inlinenoexcept

Read XCR0 (used to verify OS XSAVE support for YMM/ZMM state).

Examples
/home/runner/work/Special-Relativity-in-Financial-Modeling/Special-Relativity-in-Financial-Modeling/include/srfm/simd/cpu_features.hpp.

Definition at line 91 of file cpu_features.hpp.

Variable Documentation

◆ ABS_MASK_U64

constexpr std::uint64_t srfm::simd::detail::ABS_MASK_U64 = 0x7FFF'FFFF'FFFF'FFFFu
staticconstexpr

Definition at line 33 of file beta_avx2.cpp.

◆ BETA_CLAMP_LIMIT [1/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:
=
constexpr double BETA_MAX_SAFE
Definition momentum.hpp:62

Definition at line 30 of file beta_avx2.cpp.

◆ BETA_CLAMP_LIMIT [2/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:

Definition at line 30 of file beta_avx512.cpp.

◆ BETA_CLAMP_LIMIT [3/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:

Definition at line 35 of file beta_scalar.cpp.

◆ BETA_CLAMP_LIMIT [4/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:

Definition at line 37 of file gamma_avx2.cpp.

◆ BETA_CLAMP_LIMIT [5/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:

Definition at line 52 of file gamma_avx512.cpp.

◆ BETA_CLAMP_LIMIT [6/6]

constexpr double srfm::simd::detail::BETA_CLAMP_LIMIT
staticconstexpr
Initial value:

Definition at line 30 of file gamma_scalar.cpp.