Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
momentum_processor.cpp
Go to the documentation of this file.
1/// @file src/momentum/momentum_processor.cpp
2/// @brief MomentumProcessor — relativistic momentum corrections (AGT-06 stub).
3
4#include "srfm/momentum.hpp"
5#include "../lorentz/lorentz_transform.hpp"
6
7#include <cmath>
8
9namespace srfm::momentum {
10
11// ─── MomentumProcessor::process ───────────────────────────────────────────────
12
13std::optional<RelativisticMomentum>
15 if (signal.effective_mass <= 0.0) {
16 return std::nullopt;
17 }
18
19 // Delegate γ computation to the Lorentz engine.
21 signal.raw_value, signal.beta, signal.effective_mass);
22 if (!rel) {
23 return std::nullopt;
24 }
25
27 .raw_value = rel->raw_value,
28 .adjusted_value = rel->adjusted_value,
29 .gamma = rel->gamma,
30 .beta = signal.beta,
31 };
32}
33
34// ─── MomentumProcessor::relativistic_momentum ────────────────────────────────
35
36std::optional<double>
38 double mass,
39 double speed) noexcept {
40 if (mass <= 0.0 || !std::isfinite(speed)) {
41 return std::nullopt;
42 }
43
45 if (!g) {
46 return std::nullopt;
47 }
48
49 // p_rel = γ · m · |v| (magnitude — speed is already absolute)
50 return g->value * mass * std::abs(speed);
51}
52
53// ─── MomentumProcessor::process_series ───────────────────────────────────────
54
55std::optional<std::vector<RelativisticMomentum>>
57 std::span<const MomentumSignal> signals) noexcept {
58 if (signals.empty()) {
59 return std::nullopt;
60 }
61
62 std::vector<RelativisticMomentum> results;
63 results.reserve(signals.size());
64
65 for (const auto& sig : signals) {
66 auto r = process(sig);
67 if (r) {
68 results.push_back(*r);
69 } else {
70 // Newtonian fallback: γ = 1, adjusted = raw
71 results.push_back(RelativisticMomentum{
72 .raw_value = sig.raw_value,
73 .adjusted_value = sig.raw_value,
74 .gamma = LorentzFactor{1.0},
75 .beta = sig.beta,
76 });
77 }
78 }
79
80 return results;
81}
82
83} // namespace srfm::momentum
static std::optional< LorentzFactor > gamma(BetaVelocity beta) noexcept
static std::optional< RelativisticSignal > applyMomentumCorrection(double raw_signal, BetaVelocity beta, double effective_mass) noexcept
Normalised market velocity β = price_velocity / c_market.
Definition momentum.hpp:72
Pre-computed Lorentz factor γ = 1/√(1−β²). Always ≥ 1.0.
Definition momentum.hpp:98
static std::optional< std::vector< RelativisticMomentum > > process_series(std::span< const MomentumSignal > signals) noexcept
static std::optional< double > relativistic_momentum(BetaVelocity beta, double mass, double speed) noexcept
static std::optional< RelativisticMomentum > process(const MomentumSignal &signal) noexcept
Momentum-Velocity Signal Processor — AGT-03 public API (implemented by AGT-06).
Input descriptor for a single relativistic momentum computation.
Definition momentum.hpp:40
Result of applying relativistic momentum correction to a single signal.
Definition momentum.hpp:49
double raw_value
Original signal before correction.
Definition momentum.hpp:50