qlroms.transitions
TransitionMaps
dataclass
Transition operators with selectable mapping strategy.
Every distance is measured in the inner-product metric of the charts, ||x||_M^2 = x^T Mw x (Mw None = Euclidean, a diagonal, or a full FEM mass matrix).
Methods:
| Name | Description |
|---|---|
- "atlas" |
use Tgk/dgk/Tkg/dkg (local->global->local), exact when the atlas contains each local affine space. |
- "pairwise" |
use tmap/tshift direct chart-to-chart maps. The distance to centroid i of a state a in chart k is exact, d_i^2 = ||tshift[i,k] - a||^2 + oos2[i,k], the in-chart part plus the part of c_i - c_k that lies OUTSIDE chart k's subspace (oos2, a (K, K) matrix of squared M distances computed once from the geometry). Without oos2 (a hand-built TransitionMaps that never saw the centroids) only the in-chart part is available. |
- "auto" |
atlas when available, else pairwise. |
- "physical" |
DISTANCES only -- lift the state to physical space (centroid + Phi a) and compare to every cluster centroid directly, the ground truth the other methods reproduce (O(N) per step; needs centroids/Phi_all, see from_model): sqrt((c - x)^T Mw (c - x)), for any Mw. The map itself falls back to atlas/pairwise. |
Source code in qlroms/transitions.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
to_atlas(a, k_from)
Lift coordinate(s) a from chart k_from into the shared atlas frame: z = Tgk[k_from] a + dgk[k_from]. a: (r,) or (r, m), torch or numpy.
Source code in qlroms/transitions.py
124 125 126 127 128 129 130 | |
from_atlas(z, k_to)
Drop atlas coordinate(s) z into chart k_to: a = Tkg[k_to] z + dkg[k_to] (the exact inverse of to_atlas on chart k_to's affine subspace).
Source code in qlroms/transitions.py
132 133 134 135 136 137 138 | |
map(a, k_from, k_to)
Map coordinate(s) a from chart k_from to chart k_to.
a: (r,) or (r, m), torch.Tensor or np.ndarray (the ops are type-generic).
Source code in qlroms/transitions.py
140 141 142 143 144 145 146 147 148 | |
distances(a, k_from)
Distance from state (a in chart k_from) to all cluster centroids.
Returns:
| Type | Description |
|---|---|
|
(K,) vector with distances in chosen transition metric. |
Source code in qlroms/transitions.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
pairwise_oos2(centroids, tshift, Mw)
(K, K) squared M distance of centroid i to chart j's affine space that the chart-j coordinates cannot see: oos2[i, j] = ||c_i - c_j||_M^2 - ||tshift[i, j]||^2 (>= 0). tshift[i, j] = Phi_j^T Mw (c_i - c_j) is the in-chart part of c_i - c_j, so adding oos2 to ||tshift[i, j] - a||^2 gives the exact squared distance from a chart-j state to c_i. Computed once from the geometry; everything is centred on the mean centroid so the difference of large, nearly equal M products keeps its precision.
Source code in qlroms/transitions.py
14 15 16 17 18 19 20 21 22 23 24 25 | |