pub fn patch_isometry_flow_reparameterization(
evaluator: &dyn SaeBasisEvaluator,
decoder: ArrayView2<'_, f64>,
row_coords: ArrayView2<'_, f64>,
) -> Result<Option<PatchIsometryFlowReparameterization>, String>Expand description
Compute the minimum-isometry-defect flow reparameterization of a fitted
d = 2 free/patch atom: the canonical per-row coordinates
t̃_i = φ_θ(t_i) and the exactly-recomposed decoder.
This is the #1019 unblocked free-chart case the issue charter calls out: for
a manifold patch (a contractible Euclidean-patch atom) a global truncated
flow basis DOES exist (no hairy-ball obstruction — FreePatchFlowBasis),
so the defect is genuinely MINIMIZED (not merely measured as on the sphere).
The reference metric is the flat g_ref = I, so the canonical chart is the
uniform-speed (minimum-anisotropy) one. Everything else — the scale-invariant
isometry defect E(θ) = Σ_i ‖A_iᵀA_i − c·Ĝ_i‖²_F, the analytic profiled scale
c, the exact Gauss–Newton, the det Dφ > δ diffeomorphism guard, and the
exact-LS decoder transport with the CHART_RECOMPOSITION_REL_TOL honesty
gate — is the SHARED machinery the torus path uses
([minimize_isometry_defect_flow], [recompose_decoder_exact_ls]); see
torus_isometry_flow_reparameterization for the full derivation.
The residual chart freedom after pinning is the finite isometry group of the
flat patch with the reference uniform metric: O(2) ⋉ ℝ² (rotation +
reflection + translation) — reported on the certificate as the
PinnedByCanonicalization residual gauge.
§Honest refusals (Ok(None), never a lossy or folded swap)
- degenerate chart: empty rows/basis, non-finite coordinates, a collapsed coordinate box on some axis, or a rank-deficient pullback metric anywhere;
- the optimizer finds no strict improvement over the identity flow (the fitted chart is already minimum-defect within the flow family);
- every improving candidate violates the diffeomorphism guard;
- the basis cannot absorb
γ ∘ φ⁻¹withinCHART_RECOMPOSITION_REL_TOLon the audit grid (shared gate).