Loading...
Searching...
No Matches
GaussianSegments.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
6#pragma once
7
8#include <Eigen/Core>
9#include <cstddef>
10#include <stdexcept>
11#include <vector>
12
13namespace gpr::quantum::gaussian {
14using Matrix = Eigen::MatrixXd;
15using Vector = Eigen::VectorXd;
16
17// Physical mass-weighted Hessians have units of inverse imaginary time squared.
18// exactSegment represents its complete Dirichlet bridge. Explicit endpoint
19// blocks also describe a normalized link quadratic with supplied logDetL.
20struct Segment {
23 double logDetL{};
24 double duration{};
26 // An empty right block denotes the same endpoint curvature as A.
28 const Matrix &rightEndpoint() const
29 {
30 return rightA.size() ? rightA : A;
31 }
32};
33
34Segment exactSegment(const Matrix &hessian, double duration);
35
36struct Inertia {
37 std::size_t positive{};
38 std::size_t negative{};
39 std::size_t zero{};
40};
41
42class SingularBlockPivot : public std::runtime_error {
43public:
44 std::size_t block;
45 double tolerance;
46 SingularBlockPivot(std::size_t index, double roundoffTolerance);
47};
48
50 double logAbsD{};
51 int sign{};
54 Eigen::Index physicalDimension{};
55 double duration{};
56 std::size_t segments{};
57};
58
59// An indefinite factorization retains signed determinants and inertia; its real
60// Gaussian integral is not defined without a separate contour prescription.
62 struct Pivot {
63 Matrix eigenvectors;
64 Vector eigenvalues;
65 Matrix solve(const Matrix &rhs) const;
66 };
67 std::vector<Pivot> pivots_;
68 std::vector<Matrix> offDiagonal_;
69 Eigen::Index dimension_{};
70 double logDetL_{};
71 double logAbsDetK_{};
72 Inertia inertia_;
73 double duration_{};
74 std::size_t segments_{};
75
76public:
77 explicit Factorization(const std::vector<Segment> &segments);
78 Eigen::Index blockDimension() const
79 {
80 return dimension_;
81 }
82 Eigen::Index interiorDimension() const;
83 double duration() const
84 {
85 return duration_;
86 }
87 std::size_t segmentCount() const
88 {
89 return segments_;
90 }
91 double logAbsDetK() const
92 {
93 return logAbsDetK_;
94 }
95 double logAbsD() const
96 {
97 return logAbsDetK_ - logDetL_;
98 }
99 int determinantSign() const
100 {
101 return inertia_.negative % 2 ? -1 : 1;
102 }
103 const Inertia &inertia() const
104 {
105 return inertia_;
106 }
107 Vector solve(const Vector &rhs) const;
108 Matrix solve(const Matrix &rhs) const;
109 std::vector<Matrix> inverseDiagonalBlocks() const;
110 // The caller supplies a Euclidean-unit vector in the full nodal measure.
111 // A singular Schur pivot is a representation failure, not a phase decision.
113 double logFixedEndpointKernel(double hbar) const;
114};
115
116// Ratio of a restricted fixed-end Gaussian density to an unrestricted
117// reference. This supplies neither a collective-coordinate range nor a physical
118// splitting.
119double logRestrictedDensityRatio(const Factorization &reference,
120 const RestrictedDeterminant &restricted,
121 double action, double hbar);
122} // namespace gpr::quantum::gaussian
Factorization(const std::vector< Segment > &segments)
std::vector< Matrix > inverseDiagonalBlocks() const
Vector solve(const Vector &rhs) const
RestrictedDeterminant restrictUnitNormal(const Vector &normal) const
double logFixedEndpointKernel(double hbar) const
SingularBlockPivot(std::size_t index, double roundoffTolerance)
double logRestrictedDensityRatio(const Factorization &reference, const RestrictedDeterminant &restricted, double action, double hbar)
Segment exactSegment(const Matrix &hessian, double duration)
Eigen::MatrixXd Matrix
const Matrix & rightEndpoint() const