98 const double inv_c = 1.0 / o.
value;
99 return {
value * inv_c,
100 (
deriv * o.value -
value * o.deriv) * inv_c * inv_c};
122 return {s + d.
value, d.deriv};
125 return {s * d.
value, s * d.deriv};
223 double spatial_scale = 1.0);
232 const std::array<double, 3>& vol);
241 const Eigen::Matrix3d& cov);
278 : inner_(std::move(metric)), tol_(tol) {}
283 if (valid_ && (x - pt_).cwiseAbs().maxCoeff() < tol_) {
315 double spatial_scale = 1.0) {
322 const std::array<double, 3>& vol) {
328 const Eigen::Matrix3d& cov) {
336 mutable bool valid_{
false};
408 double cache_tol = 1e-8)
409 : inner_{metric, h}, cache_tol_{cache_tol} {}
413 if (cache_valid_ && (x - cached_point_).cwiseAbs().maxCoeff() < cache_tol_) {
414 return cached_result_;
416 cached_result_ = inner_.
compute(x);
419 return cached_result_;
434 mutable bool cache_valid_{
false};
532 return {s * g.
position, s * g.velocity};
628inline std::vector<std::vector<GeodesicState>>
631 const std::vector<std::pair<SpacetimePoint, FourVelocity>>& initial_conditions,
634 std::vector<std::vector<GeodesicState>> results(initial_conditions.size());
637 std::execution::par_unseq,
638 initial_conditions.begin(),
639 initial_conditions.end(),
641 [&solver, steps](
const std::pair<SpacetimePoint, FourVelocity>& ic) {
642 return solver.integrate(ic.first, ic.second, steps);
FourVelocity contract(const ChristoffelArray &gamma, const FourVelocity &u) const
Contract cached symbols with a four-velocity.
void invalidate() const noexcept
Invalidate the cache (e.g. after a metric parameter change).
CachedChristoffelSymbols(const MetricTensor &metric, double h=constants::DEFAULT_FD_STEP, double cache_tol=1e-8)
Construct from a metric tensor with an optional cache tolerance.
ChristoffelArray compute(const SpacetimePoint &x) const
Compute (or return cached) Christoffel symbols at point x.
bool is_lorentzian(const SpacetimePoint &x) const
Delegate: return true iff metric has Lorentzian signature (−,+,+,+) at x.
static CachedMetricTensor make_from_covariance(double time_scale, const Eigen::Matrix3d &cov)
Full covariance-based metric from a 3×3 asset covariance matrix.
CachedMetricTensor(MetricTensor metric, double tol=1e-8)
MetricMatrix evaluate(const SpacetimePoint &x) const
double spacetime_interval(const SpacetimePoint &x, const FourVelocity &dx) const
Delegate: compute ds² = g_μν dx^μ dx^ν at x.
void invalidate() const noexcept
Invalidate the cache, forcing re-evaluation on the next call to evaluate().
static CachedMetricTensor make_minkowski(double time_scale=1.0, double spatial_scale=1.0)
Flat Minkowski-like metric: g = diag(−time_scale², σ², σ², σ²).
static CachedMetricTensor make_diagonal(double time_scale, const std::array< double, 3 > &vol)
Diagonal metric from per-asset volatilities.
std::optional< MetricMatrix > inverse(const SpacetimePoint &x) const
Delegate: compute g^μν (inverse metric) at x.
FourVelocity contract(const ChristoffelArray &gamma, const FourVelocity &u) const
ChristoffelArray compute(const SpacetimePoint &x) const
FourVelocity contract(const ChristoffelArray &gamma, const FourVelocity &u) const
ChristoffelArray compute(const SpacetimePoint &x) const
double norm_squared(const SpacetimePoint &x, const FourVelocity &u) const
std::vector< GeodesicState > integrate(const SpacetimePoint &x0, const FourVelocity &u0, int steps) const
double spacetime_interval(const SpacetimePoint &x, const FourVelocity &dx) const
std::optional< MetricMatrix > inverse(const SpacetimePoint &x) const
bool is_lorentzian(const SpacetimePoint &x) const
static MetricTensor make_from_covariance(double time_scale, const Eigen::Matrix3d &cov)
static MetricTensor make_diagonal(double time_scale, const std::array< double, 3 > &vol)
void evaluate_into(const SpacetimePoint &x, MetricMatrix &out) const
static MetricTensor make_minkowski(double time_scale=1.0, double spatial_scale=1.0)
MetricMatrix evaluate(const SpacetimePoint &x) const
Physical and financial constants for the SRFM system.
static constexpr double DEFAULT_GEODESIC_STEP
Default proper-time step for geodesic integration.
static constexpr double DEFAULT_FD_STEP
Default finite-difference step for numerical metric derivatives.
Eigen::Matrix< DualNumber, SPACETIME_DIM, 1 > DualSpacetimePoint
std::function< MetricMatrix(const SpacetimePoint &)> MetricFunction
std::vector< std::vector< GeodesicState > > integrate_batch(const GeodesicSolver &solver, const std::vector< std::pair< SpacetimePoint, FourVelocity > > &initial_conditions, int steps)
std::function< DualMetricMatrix(const DualSpacetimePoint &)> DualMetricFunction
Eigen::Matrix< DualNumber, SPACETIME_DIM, SPACETIME_DIM > DualMetricMatrix
A 4×4 matrix of dual numbers — the metric evaluated at a dual-number point.
std::array< MetricMatrix, SPACETIME_DIM > ChristoffelArray
Eigen::Vector< double, SPACETIME_DIM > FourVelocity
A tangent vector at a spacetime point (four-velocity: dx^μ/dτ).
Eigen::Matrix< double, SPACETIME_DIM, SPACETIME_DIM > MetricMatrix
The covariant metric tensor g_μν: a 4×4 symmetric matrix.
Eigen::Vector< double, SPACETIME_DIM > SpacetimePoint
constexpr DualNumber operator+(double s) const noexcept
constexpr DualNumber operator/(double s) const noexcept
constexpr DualNumber operator-(double s) const noexcept
friend constexpr DualNumber operator*(double s, const DualNumber &d) noexcept
constexpr DualNumber operator-() const noexcept
constexpr DualNumber operator+(const DualNumber &o) const noexcept
constexpr DualNumber operator*(double s) const noexcept
double deriv
Infinitesimal (ε) part: the directional derivative.
friend constexpr DualNumber operator+(double s, const DualNumber &d) noexcept
constexpr DualNumber operator-(const DualNumber &o) const noexcept
constexpr DualNumber operator/(const DualNumber &o) const noexcept
constexpr DualNumber operator*(const DualNumber &o) const noexcept
Position and 4-velocity state on the manifold.
FourVelocity velocity
u^μ = dx^μ/dτ: four-velocity tangent vector
SpacetimePoint position
x^μ: position in financial spacetime
friend GeodesicState operator*(double s, const GeodesicState &g) noexcept
Scalar multiplication (used internally by RK4).
GeodesicState operator+(const GeodesicState &o) const noexcept
Pointwise addition of two states (used internally by RK4).
Shared primitive types for the Special Relativity in Financial Modeling (SRFM) system.