#![cfg(test)]
use super::tests::{deterministic_circle_noise, global_ev};
use super::tests_startup_validation_1782::{Topo, build_term};
use super::*;
use ndarray::{Array1, Array2, array};
pub(crate) struct PlantedCircle {
pub(crate) z: Array2<f64>,
pub(crate) theta: Array1<f64>,
}
pub(crate) fn planted_frame(p: usize) -> (Array1<f64>, Array1<f64>) {
let mut u = Array1::<f64>::zeros(p);
let mut v = Array1::<f64>::zeros(p);
for j in 0..p {
u[j] = ((j as f64 + 1.0) * 0.7).sin();
v[j] = ((j as f64 + 1.0) * 0.7).cos();
}
let un = u.dot(&u).sqrt();
u.mapv_inplace(|x| x / un);
let uv = u.dot(&v);
for j in 0..p {
v[j] -= uv * u[j];
}
let vn = v.dot(&v).sqrt();
v.mapv_inplace(|x| x / vn);
(u, v)
}
pub(crate) fn planted_circle_cloud(n: usize, p: usize, radius: f64, sigma: f64) -> PlantedCircle {
let (u, v) = planted_frame(p);
let theta =
Array1::<f64>::from_shape_fn(n, |i| std::f64::consts::TAU * (i as f64 + 0.5) / n as f64);
let mut z = Array2::<f64>::zeros((n, p));
for i in 0..n {
let (c, s) = (theta[i].cos(), theta[i].sin());
for j in 0..p {
z[[i, j]] =
radius * (c * u[j] + s * v[j]) + sigma * deterministic_circle_noise(i, j);
}
}
PlantedCircle { z, theta }
}
pub(crate) fn circular_recovery_r2(coord: &Array1<f64>, theta: &Array1<f64>) -> f64 {
let n = coord.len();
assert_eq!(n, theta.len());
let mut best = 0.0_f64;
for orientation in [1.0_f64, -1.0_f64] {
let (mut re, mut im) = (0.0_f64, 0.0_f64);
for i in 0..n {
let phase = theta[i] - orientation * std::f64::consts::TAU * coord[i];
re += phase.cos();
im += phase.sin();
}
re /= n as f64;
im /= n as f64;
best = best.max(re * re + im * im);
}
best
}
pub(crate) struct ChartOutcome {
pub(crate) ev: f64,
pub(crate) coord_std: f64,
pub(crate) circular_variance: f64,
pub(crate) distinct: usize,
pub(crate) distinct_wrapped: usize,
pub(crate) recovery_r2: f64,
pub(crate) log_ard: f64,
pub(crate) refusal: Option<String>,
}
pub(crate) fn fit_and_measure_chart(cloud: &PlantedCircle, n_iter: usize) -> ChartOutcome {
let z = &cloud.z;
let (mut term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho = SaeManifoldRho::new(
1.0e-3_f64.ln(),
1.0e-3_f64.ln(),
vec![array![1.0e-3_f64.ln()]; 1],
);
if let Err(error) =
term.run_joint_fit_arrow_schur(z.view(), &mut rho, None, n_iter, 1.0, 1.0e-6, 1.0e-6)
{
return ChartOutcome {
ev: f64::NAN,
coord_std: f64::NAN,
circular_variance: f64::NAN,
distinct: 0,
distinct_wrapped: 0,
recovery_r2: f64::NAN,
log_ard: rho.log_ard[0][0],
refusal: Some(format!("{error}")),
};
}
let ev = term
.try_fitted()
.map(|fitted| global_ev(z.view(), fitted.view()))
.unwrap_or(f64::NAN);
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let n = coord.len() as f64;
let mean = coord.iter().sum::<f64>() / n;
let coord_std = (coord.iter().map(|&x| (x - mean) * (x - mean)).sum::<f64>() / n).sqrt();
let (mut re, mut im) = (0.0_f64, 0.0_f64);
for &t in coord.iter() {
let phase = std::f64::consts::TAU * t;
re += phase.cos();
im += phase.sin();
}
re /= n;
im /= n;
let circular_variance = 1.0 - (re * re + im * im).sqrt();
let mut sorted: Vec<f64> = coord.iter().copied().collect();
sorted.sort_by(|a, b| a.partial_cmp(b).unwrap());
sorted.dedup();
let distinct = sorted.len();
let mut wrapped: Vec<i64> = coord
.iter()
.map(|&t| (t.rem_euclid(1.0) * 1.0e9).round() as i64 % 1_000_000_000)
.collect();
wrapped.sort_unstable();
wrapped.dedup();
let distinct_wrapped = wrapped.len();
let recovery_r2 = circular_recovery_r2(&coord, &cloud.theta);
ChartOutcome {
ev,
coord_std,
circular_variance,
distinct,
distinct_wrapped,
recovery_r2,
log_ard: rho.log_ard[0][0],
refusal: None,
}
}
#[test]
fn zz_2691_chart_collapse_boundary_sweep() {
let ns: Vec<usize> = vec![60, 70, 90, 120, 180, 240];
let ps: Vec<usize> = vec![4, 6, 8, 12];
let sigmas: Vec<f64> = vec![0.0, 0.352];
let radius: f64 = 2.086;
eprintln!(
"[2691-sweep] n\tp\tsigma\tEV\tcoord_std\tcirc_var\tdistinct\tdistinct_wrapped\t\
recovery_R2\tlog_ard\tsecs\trefusal"
);
let mut worst: Option<(usize, usize, f64, f64)> = None;
for &n in &ns {
for &p in &ps {
for &sigma in &sigmas {
let cloud = planted_circle_cloud(n, p, radius, sigma);
let start = std::time::Instant::now();
let outcome = fit_and_measure_chart(&cloud, 40);
let secs = start.elapsed().as_secs_f64();
match &outcome.refusal {
Some(message) => {
let first = message.lines().next().unwrap_or("").to_string();
eprintln!(
"[2691-sweep] {n}\t{p}\t{sigma:.3}\t-\t-\t-\t-\t-\t-\t{:.3}\t\
{secs:.1}\tREFUSED: {first}",
outcome.log_ard
);
}
None => eprintln!(
"[2691-sweep] {n}\t{p}\t{sigma:.3}\t{:.4}\t{:.3e}\t{:.3e}\t{}/{n}\t{}/{n}\t\
{:.4}\t{:.3}\t{secs:.1}\t-",
outcome.ev,
outcome.coord_std,
outcome.circular_variance,
outcome.distinct,
outcome.distinct_wrapped,
outcome.recovery_r2,
outcome.log_ard
),
}
if outcome.refusal.is_none()
&& worst.is_none_or(|(_, _, _, r2)| outcome.recovery_r2 < r2)
{
worst = Some((n, p, sigma, outcome.recovery_r2));
}
}
}
}
let (n, p, sigma, r2) = worst.expect("the sweep must fit at least one cell");
assert!(
r2 > 0.9,
"#2691: the inner joint fit must recover the planted circle at a fixed ρ; worst cell n={n} p={p} sigma={sigma} recovery R²={r2:.4}"
);
}
pub(crate) fn planted_line_cloud(n: usize, p: usize, span: f64, sigma: f64) -> PlantedCircle {
let mut u = Array1::<f64>::zeros(p);
for j in 0..p {
u[j] = ((j as f64 + 1.0) * 0.7).sin();
}
let un = u.dot(&u).sqrt();
u.mapv_inplace(|x| x / un);
let theta = Array1::<f64>::from_shape_fn(n, |i| (i as f64 + 0.5) / n as f64 - 0.5);
let mut z = Array2::<f64>::zeros((n, p));
for i in 0..n {
for j in 0..p {
z[[i, j]] = span * theta[i] * u[j] + sigma * deterministic_circle_noise(i, j);
}
}
PlantedCircle { z, theta }
}
#[test]
fn zz_2691_euclidean_line_refusal_sweep() {
let ns: Vec<usize> = vec![70];
let ps: Vec<usize> = vec![3, 4, 6, 8, 12, 16];
let sigmas: Vec<f64> = vec![0.0, 0.352];
eprintln!("[2691-line] n\tp\tsigma\tEV\tcoord_std\trecovery_R2\tsecs\trefusal");
for &n in &ns {
for &p in &ps {
for &sigma in &sigmas {
let cloud = planted_line_cloud(n, p, 4.0, sigma);
let z = &cloud.z;
let (mut term, _disp) =
build_term(z.view(), 1, Topo::Euclidean, AssignmentMode::softmax(1.0));
let mut rho = SaeManifoldRho::new(
1.0e-3_f64.ln(),
1.0e-3_f64.ln(),
vec![array![1.0e-3_f64.ln()]; 1],
);
let start = std::time::Instant::now();
let result = term.run_joint_fit_arrow_schur(
z.view(),
&mut rho,
None,
40,
1.0,
1.0e-6,
1.0e-6,
);
let secs = start.elapsed().as_secs_f64();
match result {
Err(error) => {
let text = format!("{error}").replace('\n', " ");
eprintln!("[2691-line] {n}\t{p}\t{sigma:.3}\t-\t-\t-\t{secs:.1}\tREFUSED: {text}");
}
Ok(_) => {
let ev = term
.try_fitted()
.map(|fitted| global_ev(z.view(), fitted.view()))
.unwrap_or(f64::NAN);
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let nn = coord.len() as f64;
let cm = coord.iter().sum::<f64>() / nn;
let tm = cloud.theta.iter().sum::<f64>() / nn;
let (mut sxy, mut sxx, mut syy) = (0.0_f64, 0.0_f64, 0.0_f64);
for i in 0..coord.len() {
let a = coord[i] - cm;
let b = cloud.theta[i] - tm;
sxy += a * b;
sxx += a * a;
syy += b * b;
}
let r2 = if sxx > 0.0 && syy > 0.0 {
sxy * sxy / (sxx * syy)
} else {
0.0
};
let std = (sxx / nn).sqrt();
eprintln!(
"[2691-line] {n}\t{p}\t{sigma:.3}\t{ev:.4}\t{std:.3e}\t{r2:.4}\t{secs:.1}\t-"
);
}
}
}
}
}
}
#[test]
fn zz_2691_outer_path_chart_collapse_sweep() {
use crate::manifold::{
SaeFitAssignmentKind, SaeFitConfig, SaeFitRequest, SaeFitSeedReport, SaeFitSeedRequest,
SaeMinimalSeedReport, SaeMinimalSeedRequest, build_sae_fit_seed, build_sae_minimal_seed,
run_sae_manifold_fit,
};
use gam_terms::analytic_penalties::AnalyticPenaltyRegistry;
let ns: Vec<usize> = vec![70];
let ps: Vec<usize> = vec![8];
let sigmas: Vec<f64> = vec![0.352];
let radius: f64 = 2.086;
eprintln!(
"[2691-outer] n\tp\tsigma\tR2rec\tcoord_std\tcirc_var\tdistinct_wrapped\trecovery_R2\t\
log_ard\tsecs\trefusal"
);
for &n in &ns {
for &p in &ps {
for &sigma in &sigmas {
let cloud = planted_circle_cloud(n, p, radius, sigma);
let target = cloud.z.clone();
let start = std::time::Instant::now();
let minimal = build_sae_minimal_seed(SaeMinimalSeedRequest {
target: target.view(),
atom_basis: vec!["periodic".to_string()],
atom_dim: vec![1],
assignment_kind: SaeFitAssignmentKind::Softmax,
alpha: 1.0,
tau: 1.0,
threshold: 0.0,
top_k: None,
random_state: 20260731,
initial_logits: None,
initial_coords: None,
})
.expect("minimal seed");
let SaeMinimalSeedReport {
geometry_plans,
basis_values,
basis_jacobian,
decoder_coefficients,
smooth_penalties,
initial_logits,
initial_coords,
refine_routing,
} = minimal;
let registry = AnalyticPenaltyRegistry::new();
let seed = build_sae_fit_seed(SaeFitSeedRequest {
target: target.view(),
geometry_plans: &geometry_plans,
basis_values: basis_values.view(),
basis_jacobian: basis_jacobian.view(),
decoder_coefficients: decoder_coefficients.view(),
smooth_penalties: smooth_penalties.view(),
initial_logits: initial_logits.view(),
initial_coords: initial_coords.view(),
alpha: 1.0,
tau: 1.0,
learnable_alpha: false,
assignment_kind: SaeFitAssignmentKind::Softmax,
sparsity_strength: 1.0,
smoothness: 1.0,
max_iter: 40,
learning_rate: 1.0,
ridge_ext_coord: 1.0e-6,
ridge_beta: 1.0e-6,
top_k: None,
threshold: 0.0,
native_ard_enabled: true,
seed_refine_routing: refine_routing,
seed_refine_random_state: 20260731,
data_row_reseed: false,
fit_config: SaeFitConfig::default(),
temperature_schedule: None,
fisher_metric: None,
row_loss_weights: None,
registry: ®istry,
})
.expect("fit seed");
let SaeFitSeedReport {
base_term,
initial_rho,
isometry_pin_active,
metric_provenance,
} = seed;
let outcome = run_sae_manifold_fit(SaeFitRequest {
reconstruction_optimism_folds: None,
base_term,
target: target.clone(),
registry,
initial_rho,
max_iter: 40,
learning_rate: 1.0,
ridge_ext_coord: 1.0e-6,
ridge_beta: 1.0e-6,
alpha: 1.0,
isometry_pin_active,
metric_provenance,
promote_from_residual: false,
run_structure_search: false,
run_outer_rho_search: true,
structured_residual_passes: 0,
cancel: None,
});
let secs = start.elapsed().as_secs_f64();
let report = match outcome
.map_err(|error| format!("{error}"))
.and_then(|o| o.manifold_or_error())
{
Ok(report) => report,
Err(error) => {
let text = error.replace('\n', " ");
eprintln!(
"[2691-outer] {n}\t{p}\t{sigma:.3}\t-\t-\t-\t-\t-\t-\t{secs:.1}\t\
REFUSED: {text}"
);
continue;
}
};
let coords = report.term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let nn = coord.len() as f64;
let mean = coord.iter().sum::<f64>() / nn;
let coord_std =
(coord.iter().map(|&x| (x - mean) * (x - mean)).sum::<f64>() / nn).sqrt();
let (mut re, mut im) = (0.0_f64, 0.0_f64);
for &t in coord.iter() {
let phase = std::f64::consts::TAU * t;
re += phase.cos();
im += phase.sin();
}
re /= nn;
im /= nn;
let circular_variance = 1.0 - (re * re + im * im).sqrt();
let mut wrapped: Vec<i64> = coord
.iter()
.map(|&t| (t.rem_euclid(1.0) * 1.0e9).round() as i64 % 1_000_000_000)
.collect();
wrapped.sort_unstable();
wrapped.dedup();
let recovery_r2 = circular_recovery_r2(&coord, &cloud.theta);
eprintln!(
"[2691-outer] {n}\t{p}\t{sigma:.3}\t{:.4}\t{coord_std:.3e}\t\
{circular_variance:.3e}\t{}/{n}\t{recovery_r2:.4}\t{:.3}\t{secs:.1}\t-",
report.reconstruction_r2,
wrapped.len(),
report.rho.log_ard[0][0]
);
}
}
}
}
#[test]
fn zz_2691_ard_precision_ladder_collapses_the_chart() {
let n: usize = 70;
let p: usize = 8;
let cloud = planted_circle_cloud(n, p, 2.086, 0.352);
let z = &cloud.z;
let ladder: Vec<f64> = vec![
1.0e-3_f64.ln(),
1.0_f64.ln(),
1.0e1_f64.ln(),
1.0e2_f64.ln(),
1.0e3_f64.ln(),
1.0e4_f64.ln(),
1.0e6_f64.ln(),
1.0e9_f64.ln(),
];
eprintln!("[2691-ard] log_ard\talpha\tEV\tcoord_std\tcirc_var\tdistinct_wrapped\trecovery_R2");
let mut rungs: Vec<(f64, f64, usize)> = Vec::new();
for &log_ard in &ladder {
let (mut term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho =
SaeManifoldRho::new(1.0e-3_f64.ln(), 1.0e-3_f64.ln(), vec![array![log_ard]; 1]);
let fit =
term.run_joint_fit_arrow_schur(z.view(), &mut rho, None, 40, 1.0, 1.0e-6, 1.0e-6);
if let Err(error) = fit {
let text = format!("{error}").replace('\n', " ");
eprintln!("[2691-ard] {log_ard:.3}\t{:.3e}\tREFUSED: {text}", log_ard.exp());
continue;
}
let ev = term
.try_fitted()
.map(|fitted| global_ev(z.view(), fitted.view()))
.unwrap_or(f64::NAN);
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let nn = coord.len() as f64;
let mean = coord.iter().sum::<f64>() / nn;
let coord_std = (coord.iter().map(|&x| (x - mean) * (x - mean)).sum::<f64>() / nn).sqrt();
let (mut re, mut im) = (0.0_f64, 0.0_f64);
for &t in coord.iter() {
let phase = std::f64::consts::TAU * t;
re += phase.cos();
im += phase.sin();
}
re /= nn;
im /= nn;
let circular_variance = 1.0 - (re * re + im * im).sqrt();
let mut wrapped: Vec<i64> = coord
.iter()
.map(|&t| (t.rem_euclid(1.0) * 1.0e9).round() as i64 % 1_000_000_000)
.collect();
wrapped.sort_unstable();
wrapped.dedup();
let recovery_r2 = circular_recovery_r2(&coord, &cloud.theta);
eprintln!(
"[2691-ard] {log_ard:.3}\t{:.3e}\t{ev:.4}\t{coord_std:.3e}\t{circular_variance:.3e}\t\
{}/{n}\t{recovery_r2:.4}",
log_ard.exp(),
wrapped.len()
);
rungs.push((log_ard.exp(), circular_variance, wrapped.len()));
}
if let (Some(low), Some(high)) = (
rungs.iter().find(|(alpha, _, _)| *alpha <= 1.0e-3),
rungs.iter().find(|(alpha, _, _)| *alpha >= 1.0e9),
) {
assert!(
low.1 > 0.5,
"#2691: at α=1e-3 the chart must still be spread over the circle (circular variance {:.3e})",
low.1
);
assert!(
high.1 < 1.0e-6 && high.2 <= 1,
"#2691: raising ONLY the von-Mises coordinate precision to α=1e9 must collapse the chart to one point — this is the mechanism the guard exists for (circular variance {:.3e}, {} resolved chart points)",
high.1,
high.2
);
}
}
#[test]
fn zz_2691_collapsed_chart_is_refused_by_the_production_entry() {
use crate::manifold::{
SaeFitAssignmentKind, SaeFitConfig, SaeFitError, SaeFitRequest, SaeFitSeedReport,
SaeFitSeedRequest, SaeMinimalSeedReport, SaeMinimalSeedRequest, build_sae_fit_seed,
build_sae_minimal_seed, run_sae_manifold_fit,
};
use gam_terms::analytic_penalties::AnalyticPenaltyRegistry;
let cloud = planted_circle_cloud(70, 8, 2.086, 0.352);
let target = cloud.z.clone();
let minimal = build_sae_minimal_seed(SaeMinimalSeedRequest {
target: target.view(),
atom_basis: vec!["periodic".to_string()],
atom_dim: vec![1],
assignment_kind: SaeFitAssignmentKind::Softmax,
alpha: 1.0,
tau: 1.0,
threshold: 0.0,
top_k: None,
random_state: 20260731,
initial_logits: None,
initial_coords: None,
})
.expect("minimal seed");
let SaeMinimalSeedReport {
geometry_plans,
basis_values,
basis_jacobian,
decoder_coefficients,
smooth_penalties,
initial_logits,
initial_coords,
refine_routing,
} = minimal;
let registry = AnalyticPenaltyRegistry::new();
let seed = build_sae_fit_seed(SaeFitSeedRequest {
target: target.view(),
geometry_plans: &geometry_plans,
basis_values: basis_values.view(),
basis_jacobian: basis_jacobian.view(),
decoder_coefficients: decoder_coefficients.view(),
smooth_penalties: smooth_penalties.view(),
initial_logits: initial_logits.view(),
initial_coords: initial_coords.view(),
alpha: 1.0,
tau: 1.0,
learnable_alpha: false,
assignment_kind: SaeFitAssignmentKind::Softmax,
sparsity_strength: 1.0,
smoothness: 1.0,
max_iter: 40,
learning_rate: 1.0,
ridge_ext_coord: 1.0e-6,
ridge_beta: 1.0e-6,
top_k: None,
threshold: 0.0,
native_ard_enabled: true,
seed_refine_routing: refine_routing,
seed_refine_random_state: 20260731,
data_row_reseed: false,
fit_config: SaeFitConfig::default(),
temperature_schedule: None,
fisher_metric: None,
row_loss_weights: None,
registry: ®istry,
})
.expect("fit seed");
let SaeFitSeedReport {
base_term,
mut initial_rho,
isometry_pin_active,
metric_provenance,
} = seed;
for axis in initial_rho.log_ard.iter_mut() {
axis.fill(1.0e9_f64.ln());
}
let outcome = run_sae_manifold_fit(SaeFitRequest {
reconstruction_optimism_folds: None,
base_term,
target,
registry,
initial_rho,
max_iter: 40,
learning_rate: 1.0,
ridge_ext_coord: 1.0e-6,
ridge_beta: 1.0e-6,
alpha: 1.0,
isometry_pin_active,
metric_provenance,
promote_from_residual: false,
run_structure_search: false,
run_outer_rho_search: false,
structured_residual_passes: 0,
cancel: None,
});
match outcome {
Err(SaeFitError::DegenerateChart {
atoms,
evidence,
report,
}) => {
eprintln!("[2691-regression] refused as required: atoms={atoms:?} {evidence}");
assert_eq!(
atoms,
vec![0],
"the single K=1 atom must be the one named as chart-less"
);
assert!(
report.axes.iter().all(|axis| axis.resolved_points <= 1),
"the collapsed chart axis must resolve at most one chart point; got {:?}",
report
.axes
.iter()
.map(|axis| axis.resolved_points)
.collect::<Vec<_>>()
);
}
Err(other) => panic!(
"#2691: a chart collapsed to one point must refuse as DegenerateChart, got: {other}"
),
Ok(outcome) => {
let report = outcome
.manifold_or_error()
.expect("outcome carried a manifold");
let coords = report.term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let chart = report.term.chart_degeneracy_report();
panic!(
"#2691 REGRESSION: the production entry certified a collapsed chart. \
reconstruction_r2={:.4}, chart dispersion={:?}, resolved chart points={:?}, \
first coordinates={:?}",
report.reconstruction_r2,
chart
.axes
.iter()
.map(|axis| axis.dispersion)
.collect::<Vec<_>>(),
chart
.axes
.iter()
.map(|axis| axis.resolved_points)
.collect::<Vec<_>>(),
coord.iter().take(5).collect::<Vec<_>>()
);
}
}
}
fn ard_face_for(n: usize, p: usize, radius: f64, sigma: f64) -> (f64, f64, f64) {
use gam_solve::rho_optimizer::OuterObjective;
let cloud = planted_circle_cloud(n, p, radius, sigma);
let z = &cloud.z;
let (term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let period = term.assignment.coords[0].effective_axis_periods()[0]
.expect("the circle chart axis must carry a period");
let rho = SaeManifoldRho::new(
1.0e-3_f64.ln(),
1.0e-3_f64.ln(),
vec![array![1.0e-3_f64.ln()]; 1],
)
.for_assignment(term.assignment.mode);
let ard_index = rho.ard_flat_index(0, 0);
let seed = rho.to_flat()[ard_index];
let objective =
SaeManifoldOuterObjective::new(term, z.clone(), None, rho, 40, 1.0, 1.0e-6, 1.0e-6);
let upper = objective
.outer_domain_upper_bound()
.expect("the SAE outer domain face must be constructible")
.expect("the SAE outer objective declares a typed upper face");
(upper[ard_index], seed, period)
}
#[test]
fn zz_2691_the_ard_domain_face_moves_with_the_data_not_with_binary64() {
let n: usize = 70;
let (face_r1, seed, period) = ard_face_for(n, 8, 2.086, 0.352);
let (face_r2, _, period_2) = ard_face_for(n, 8, 2.0 * 2.086, 2.0 * 0.352);
assert_eq!(period, period_2, "the chart period must not depend on scale");
let resolution_face = 2.0 * ((2.0 * n as f64) / period).ln();
eprintln!(
"[2691-face] period={period} seed_log_ard={seed:.4} face(r=2.086)={face_r1:.6} \
face(r=4.172)={face_r2:.6} resolution_face={resolution_face:.6} RHO_BOUND={} \
LOG_STRENGTH_MAX={}",
gam_solve::estimate::RHO_BOUND,
gam_problem::LOG_STRENGTH_MAX,
);
assert!(
face_r1 < gam_solve::estimate::RHO_BOUND,
"#2691: a face at or above the generic ρ box ({}) constrains nothing; got {face_r1:.6}",
gam_solve::estimate::RHO_BOUND
);
assert!(
face_r1 < gam_problem::LOG_STRENGTH_MAX,
"#2691: the ARD face must not be the binary64 representability policy ({}); got {face_r1:.6}",
gam_problem::LOG_STRENGTH_MAX
);
assert!(
face_r1 <= resolution_face + 1.0e-12,
"#2691: the installed face {face_r1:.6} must not exceed the chart-resolution face {resolution_face:.6}"
);
assert!(
seed < face_r1,
"#2691: the face must still admit the seeded ARD entry {seed:.6}; got {face_r1:.6}"
);
let delta = face_r2 - face_r1;
let expected = 2.0 * std::f64::consts::LN_2;
assert!(
(delta - expected).abs() <= 1.0e-6 * expected,
"#2691: doubling the planted cloud must raise the data-curvature face by 2·ln 2 = {expected:.6}; got {delta:.6}. A face that does not move with the data is a constant, not a derivation (and a face still pinned to the chart-resolution limit would not move either — resolution_face={resolution_face:.6})"
);
}
#[test]
fn zz_2691_the_face_excludes_every_precision_this_chart_cannot_carry() {
let n: usize = 70;
let (face, seed, period) = ard_face_for(n, 8, 2.086, 0.352);
let resolution_face = 2.0 * ((2.0 * n as f64) / period).ln();
let cloud = planted_circle_cloud(n, 8, 2.086, 0.352);
let z = &cloud.z;
let recovery_at = |log_ard: f64| -> Option<f64> {
let (mut term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho =
SaeManifoldRho::new(1.0e-3_f64.ln(), 1.0e-3_f64.ln(), vec![array![log_ard]; 1]);
term.run_joint_fit_arrow_schur(z.view(), &mut rho, None, 40, 1.0, 1.0e-6, 1.0e-6)
.ok()?;
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
Some(circular_recovery_r2(&coord, &cloud.theta))
};
let ladder: Vec<f64> = vec![
1.0e-3, 1.0e0, 1.0e1, 2.0e1, 4.0e1, 8.0e1, 1.6e2, 3.2e2, 1.0e3, 1.0e4, 1.0e6, 1.0e9,
];
let mut healthy_outside: Vec<f64> = Vec::new();
let mut best: Option<(f64, f64)> = None;
let mut last_healthy: Option<f64> = None;
let mut first_dead: Option<f64> = None;
eprintln!(
"[2691-sep] face={face:.4} resolution_face={resolution_face:.4} seed={seed:.4}"
);
for alpha in ladder {
let log_ard = alpha.ln();
let Some(r2) = recovery_at(log_ard) else {
eprintln!("[2691-sep] alpha={alpha:.3e} log_ard={log_ard:.3} REFUSED");
continue;
};
let inside = log_ard <= face;
eprintln!(
"[2691-sep] alpha={alpha:.3e} log_ard={log_ard:.3} inside={inside} recovery_R2={r2:.4}"
);
if best.is_none_or(|(_, b)| r2 > b) {
best = Some((log_ard, r2));
}
if r2 > 0.9 {
last_healthy = Some(log_ard);
if !inside {
healthy_outside.push(log_ard);
}
} else if r2 < 0.5 && first_dead.is_none() {
first_dead = Some(log_ard);
}
}
let (best_log_ard, best_r2) = best.expect("the ladder must fit at least one rung");
let transition = first_dead.expect(
"the ladder must reach a dead rung (R² < 0.5) or it cannot say where the chart fails",
);
eprintln!(
"[2691-gap] last_healthy_log_ard={:?} first_dead_log_ard={transition:.4} \
installed_face={face:.4} face_minus_first_dead={:.4} \
resolution_face_minus_first_dead={:.4}",
last_healthy,
face - transition,
resolution_face - transition
);
assert!(
best_log_ard <= face,
"#2691 ACCEPT half: the face {face:.4} excludes the healthiest precision on the ladder \
(log_ard {best_log_ard:.4}, recovery R² {best_r2:.4}) — the face is too tight"
);
assert!(
seed < face,
"#2691: the face must still admit the seeded ARD entry {seed:.6}; got {face:.6}"
);
assert!(
healthy_outside.is_empty(),
"#2691 REJECT half: the face {face:.4} excludes precisions this chart SURVIVES \
(recovery R² > 0.9) at log_ard {healthy_outside:?} — the face is too tight"
);
assert!(
face < resolution_face,
"#2691: the data-curvature face must bind on this fixture — installed {face:.4} is not \
below the chart-resolution face {resolution_face:.4}, so the two-order gap the ladder \
measured is untouched"
);
}
#[test]
fn zz_2691_bounded_sigma_witness_returns_an_answer_at_every_sigma() {
let n: usize = 70;
let p: usize = 8;
let radius: f64 = 2.086;
let sigmas: Vec<f64> = vec![0.352, 1.0, 1.5];
let mut any_moved = false;
let mut on_generic_box: Vec<f64> = Vec::new();
let mut outside_face: Vec<(f64, f64, f64)> = Vec::new();
eprintln!("[2691-sigma] sigma\tface\tseed\tterminal_log_ard\tmoved\tconverged\tsecs");
for &sigma in &sigmas {
let (face, seed, _period) = ard_face_for(n, p, radius, sigma);
let cloud = planted_circle_cloud(n, p, radius, sigma);
let z = &cloud.z;
let (term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let rho = SaeManifoldRho::new(
1.0e-3_f64.ln(),
1.0e-3_f64.ln(),
vec![array![1.0e-3_f64.ln()]; 1],
)
.for_assignment(term.assignment.mode);
let ard_index = rho.ard_flat_index(0, 0);
let rho_flat = rho.to_flat();
let n_params = rho_flat.len();
let mut objective =
SaeManifoldOuterObjective::new(term, z.clone(), None, rho, 40, 1.0, 1.0e-6, 1.0e-6);
let start = std::time::Instant::now();
let result = gam_solve::rho_optimizer::OuterProblem::new(n_params)
.with_initial_rho(rho_flat.clone())
.with_max_iter(8)
.run(&mut objective, "SAE #2691 bounded σ witness");
let secs = start.elapsed().as_secs_f64();
let (terminal, converged) = match &result {
Ok(outcome) => (outcome.rho[ard_index], outcome.converged()),
Err(error) => {
eprintln!(
"[2691-sigma] {sigma:.3}\t{face:.4}\t{seed:.4}\t-\t-\t-\t{secs:.1}\tREFUSED: {}",
format!("{error}").replace('\n', " ")
);
continue;
}
};
let moved = (terminal - seed).abs() > 1.0e-9;
any_moved |= moved;
eprintln!(
"[2691-sigma] {sigma:.3}\t{face:.4}\t{seed:.4}\t{terminal:.4}\t{moved}\t{converged}\t{secs:.1}"
);
if (terminal - gam_solve::estimate::RHO_BOUND).abs() <= 1.0e-6 {
on_generic_box.push(sigma);
}
if terminal > face + 1.0e-9 {
outside_face.push((sigma, terminal, face));
}
}
assert!(
any_moved,
"#2691: the bounded σ witness never moved the ARD coordinate off its seed at any σ, so \
it cannot say anything about railing — raise the iteration budget or the fixture is mute"
);
assert!(
on_generic_box.is_empty(),
"#2691: the terminal ARD log-precision sat on the generic ρ box ({}) at σ {on_generic_box:?} \
— that is the rail this issue was filed on",
gam_solve::estimate::RHO_BOUND
);
assert!(
outside_face.is_empty(),
"#2691: the terminal ARD log-precision escaped its installed face at (σ, terminal, face) \
{outside_face:?}"
);
}
#[test]
fn zz_2691_is_the_residual_gap_scale_invariant() {
let n: usize = 70;
let p: usize = 8;
let ladder: Vec<f64> = (0..57).map(|k| 2.0_f64.powf(k as f64 / 4.0)).collect();
let mut brackets: Vec<(f64, f64, f64, f64)> = Vec::new();
for &scale in &[1.0_f64, 2.0_f64] {
let radius = 2.086 * scale;
let sigma = 0.352 * scale;
let (face, _seed, _period) = ard_face_for(n, p, radius, sigma);
let curvature = face.exp();
let cloud = planted_circle_cloud(n, p, radius, sigma);
let z = &cloud.z;
let mut last_healthy = f64::NAN;
let mut first_dead = f64::NAN;
for &alpha in &ladder {
let log_ard = alpha.ln();
let (mut term, _disp) =
build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho =
SaeManifoldRho::new(1.0e-3_f64.ln(), 1.0e-3_f64.ln(), vec![array![log_ard]; 1]);
if term
.run_joint_fit_arrow_schur(z.view(), &mut rho, None, 40, 1.0, 1.0e-6, 1.0e-6)
.is_err()
{
continue;
}
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let r2 = circular_recovery_r2(&coord, &cloud.theta);
eprintln!("[2691-scale] scale={scale} alpha={alpha:.3} recovery_R2={r2:.4}");
if r2 > 0.9 {
last_healthy = alpha;
} else if r2 < 0.5 && first_dead.is_nan() {
first_dead = alpha;
}
}
assert!(
last_healthy.is_finite() && first_dead.is_finite(),
"#2691: the ladder must bracket the transition at scale {scale}; got \
last_healthy={last_healthy} first_dead={first_dead}"
);
let c_lo = curvature / first_dead;
let c_hi = curvature / last_healthy;
eprintln!(
"[2691-scale] scale={scale} curvature={curvature:.4} face={face:.4} \
transition_in=({last_healthy:.3},{first_dead:.3}] c_in=[{c_lo:.4},{c_hi:.4})"
);
brackets.push((scale, curvature, last_healthy, first_dead));
}
let (s1, curv1, lh1, fd1) = brackets[0];
let (s2, curv2, lh2, fd2) = brackets[1];
let (c1_lo, c1_hi) = (curv1 / fd1, curv1 / lh1);
let (c2_lo, c2_hi) = (curv2 / fd2, curv2 / lh2);
eprintln!(
"[2691-scale-verdict] curvature {curv1:.4}->{curv2:.4} (ratio {:.4}, expected 4) \
transition ({lh1:.3},{fd1:.3}]->({lh2:.3},{fd2:.3}] (ratio {:.4}) \
c_bracket scale={s1}: [{c1_lo:.3},{c1_hi:.3}) scale={s2}: [{c2_lo:.3},{c2_hi:.3})",
curv2 / curv1,
fd2 / fd1
);
assert!(
(curv2 / curv1 - 4.0).abs() <= 1.0e-6 * 4.0,
"#2691: the observed curvature must scale as scale^2; got ratio {:.6}",
curv2 / curv1
);
assert!(
c1_lo < c2_hi && c2_lo < c1_hi,
"#2691: the dimensionless gap c = curvature/alpha* is NOT scale-invariant — \
[{c1_lo:.3},{c1_hi:.3}) at scale {s1} does not overlap [{c2_lo:.3},{c2_hi:.3}) at \
scale {s2}. The observed Gauss--Newton curvature is then the WRONG denominator for \
the residual gap, and a tighter face must be derived from something else."
);
}
#[test]
fn zz_2691_is_the_dimensionless_gap_a_universal_constant() {
let default_n: usize = 70;
let default_p: usize = 8;
let default_sigma: f64 = 0.352;
let radius: f64 = 2.086;
let cells: Vec<(&str, usize, usize, f64)> = vec![
("n", 40, default_p, default_sigma),
("n", default_n, default_p, default_sigma),
("n", 160, default_p, default_sigma),
("p", default_n, 4, default_sigma),
("p", default_n, 16, default_sigma),
("sigma", default_n, default_p, 0.176),
("sigma", default_n, default_p, 0.704),
];
let mut results: Vec<(String, usize, usize, f64, f64, f64, f64, bool)> = Vec::new();
for (axis, n, p, sigma) in cells {
let (face, _seed, _period) = ard_face_for(n, p, radius, sigma);
let resolution_face = 2.0 * ((2.0 * n as f64) / 1.0_f64).ln();
assert!(
face < resolution_face,
"#2691: cell ({axis} n={n} p={p} sigma={sigma}) has the RESOLUTION face binding \
({face:.4} vs {resolution_face:.4}), so exp(face) is not the curvature and this \
cell cannot report c"
);
let curvature = face.exp();
let cloud = planted_circle_cloud(n, p, radius, sigma);
let z = &cloud.z;
let mut curve: Vec<(f64, f64)> = Vec::new();
let mut last_healthy = f64::NAN;
let mut first_dead = f64::NAN;
for k in 0..=20 {
let alpha = curvature * 2.0_f64.powf(-5.0 + k as f64 / 4.0);
let log_ard = alpha.ln();
let (mut term, _disp) =
build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho =
SaeManifoldRho::new(1.0e-3_f64.ln(), 1.0e-3_f64.ln(), vec![array![log_ard]; 1]);
if term
.run_joint_fit_arrow_schur(z.view(), &mut rho, None, 40, 1.0, 1.0e-6, 1.0e-6)
.is_err()
{
continue;
}
let coords = term.assignment.coords[0].as_matrix();
let coord: Array1<f64> = coords.column(0).to_owned();
let r2 = circular_recovery_r2(&coord, &cloud.theta);
curve.push((alpha, r2));
if r2 > 0.9 {
last_healthy = alpha;
} else if r2 < 0.5 && first_dead.is_nan() {
first_dead = alpha;
}
}
let crossing = |level: f64| -> f64 {
for pair in curve.windows(2) {
let (a0, r0) = pair[0];
let (a1, r1) = pair[1];
if r0 >= level && r1 < level {
let t = (r0 - level) / (r0 - r1);
return (a0.ln() + t * (a1.ln() - a0.ln())).exp();
}
}
f64::NAN
};
let (a90, a70, a50) = (crossing(0.9), crossing(0.7), crossing(0.5));
assert!(
last_healthy.is_finite() && first_dead.is_finite(),
"#2691: cell ({axis} n={n} p={p} sigma={sigma}) did not bracket the transition \
(last_healthy={last_healthy} first_dead={first_dead}); the ladder does not cover it"
);
let c_lo = curvature / first_dead;
let c_hi = curvature / last_healthy;
let decay_span = if a90.is_finite() && a50.is_finite() {
a50 / a90
} else {
f64::INFINITY
};
let resolved = decay_span <= 2.0;
let c_star = if a70.is_finite() {
curvature / a70
} else {
f64::NAN
};
eprintln!(
"[2691-univ] axis={axis} n={n} p={p} sigma={sigma} curvature={curvature:.4} \
transition=({last_healthy:.4},{first_dead:.4}] c=[{c_lo:.4},{c_hi:.4}) \
c_star={c_star:.4} decay_span={decay_span:.4} resolved={resolved}{}",
if resolved {
""
} else {
" <- NON-MEASUREMENT: the 0.9->0.5 decay exceeds one octave, so no sharp \
alpha* exists for c_star to locate; excluded because the quantity has no \
referent here, NOT because it disagreed"
}
);
results.push((axis.to_string(), n, p, sigma, c_lo, c_hi, c_star, resolved));
}
let lo = results.iter().fold(f64::NEG_INFINITY, |a, r| a.max(r.4));
let hi = results.iter().fold(f64::INFINITY, |a, r| a.min(r.5));
eprintln!(
"[2691-univ-verdict] H0 grid-bracket intersection = [{lo:.4}, {hi:.4}) -> {} \
(NOTE: half-open brackets on a fixed 2^(k/4) grid cannot express agreement AT a grid \
point, so this statistic tests agreement AND grid alignment; the c_star spread below \
is the one that measures agreement)",
if lo < hi { "NON-EMPTY" } else { "EMPTY (H0 refuted)" }
);
for (axis, n, p, sigma, c_lo, c_hi, c_star, resolved) in &results {
let width = c_hi / c_lo;
let rungs = (width.log2() * 4.0).round() as i64;
eprintln!(
"[2691-univ-cell] {axis} n={n} p={p} sigma={sigma} c=[{c_lo:.4},{c_hi:.4}) \
width={width:.4} rungs={rungs} c_star={c_star:.4} resolved={resolved}"
);
}
let sharp: Vec<f64> = results
.iter()
.filter(|r| r.7 && r.6.is_finite())
.map(|r| r.6)
.collect();
assert!(
sharp.len() >= 2,
"#2691: fewer than two cells produced a resolved transition, so no agreement \
statistic exists; got {} of {}",
sharp.len(),
results.len()
);
let c_min = sharp.iter().copied().fold(f64::INFINITY, f64::min);
let c_max = sharp.iter().copied().fold(f64::NEG_INFINITY, f64::max);
let grid_step = 2.0_f64.powf(0.25);
eprintln!(
"[2691-univ-spread] resolved cells={} c_star in [{c_min:.4}, {c_max:.4}] spread={:.4} \
grid_step={grid_step:.4} spread_in_rungs={:.2}",
sharp.len(),
c_max / c_min,
(c_max / c_min).log2() * 4.0
);
for (axis, n, p, sigma, c_lo, c_hi, _c_star, _resolved) in &results {
assert!(
*c_lo > 1.0 && *c_hi < 32.0,
"#2691: cell ({axis} n={n} p={p} sigma={sigma}) has c=[{c_lo:.4},{c_hi:.4}) at or \
outside the ladder edge -- the transition escaped a 32x window below the measured \
curvature, so the curvature is no longer the right order for it here"
);
}
}
#[test]
fn zz_2691_a_collapsed_atom_beside_a_healthy_one_is_named() {
use ndarray::Array2;
let cloud = planted_circle_cloud(70, 8, 2.086, 0.352);
let (mut term, _disp) =
build_term(cloud.z.view(), 2, Topo::Circle, AssignmentMode::softmax(1.0));
let n = cloud.z.nrows();
term.assignment.coords[0].set_flat(Array1::<f64>::zeros(n).view());
let report = term.chart_degeneracy_report();
let assignments = term.assignment.assignments();
for axis in report.axes.iter() {
eprintln!(
"[2691-k2] atom {} axis {} dispersion {:.6e} floor {:.6e} resolved_points {} \
degenerate {}",
axis.atom,
axis.axis,
axis.dispersion,
axis.floor,
axis.resolved_points,
axis.degenerate()
);
}
assert_eq!(
report.atom_count, 2,
"the fixture must be the K=2 case; got {} atoms",
report.atom_count
);
assert!(
report.axes.iter().any(|axis| axis.atom == 1 && !axis.degenerate()),
"#2691: this witness is only the partial-collapse case if atom 1's chart SURVIVED — \
otherwise it is the already-covered all-atoms collapse. Axes: {:?}",
report.axes
);
assert_eq!(
report.atoms_without_a_chart(),
vec![0],
"the placed collapse must be seen on atom 0 and only atom 0"
);
assert!(
report.atoms_without_a_chart().len() != report.atom_count,
"#2691: the fit-level `all atoms collapsed` condition must be FALSE here — if it were \
true this fixture would not be the partial collapse the guard is being extended for"
);
let load_bearing = load_bearing_atoms(assignments.view());
eprintln!("[2691-k2] load_bearing={load_bearing:?}");
assert_eq!(
report.chart_less_load_bearing_atoms(assignments.view()),
vec![0],
"#2691: a collapsed atom that carries assignment mass must be named; assignments \
column sums = {:?}",
(0..assignments.ncols())
.map(|k| assignments.column(k).sum())
.collect::<Vec<_>>()
);
let evidence = report.atom_evidence(&[0]);
eprintln!("[2691-k2] evidence: {evidence}");
assert!(
evidence.contains("did NOT collapse"),
"#2691: the refusal evidence must show the surviving chart beside the collapsed one, \
because that pairing is what a fit-level aggregate hides; got: {evidence}"
);
let mut unused = Array2::<f64>::zeros(assignments.raw_dim());
for row in 0..unused.nrows() {
unused[[row, 1]] = 1.0;
}
assert_eq!(
load_bearing_atoms(unused.view()),
vec![false, true],
"an atom with zero assignment mass on every row cannot change the reconstruction at f64"
);
assert!(
report.chart_less_load_bearing_atoms(unused.view()).is_empty(),
"#2691: a collapsed atom that carries NO representable assignment mass must not be \
named — its chart is unobserved, and refusing on it would refuse fits that are fine"
);
}
#[test]
fn zz_2691_recovered_versus_planted_ring() {
let (n, p, sigma) = (70_usize, 8_usize, 0.352_f64);
let cloud = planted_circle_cloud(n, p, 2.086, sigma);
let (u, v) = planted_frame(p);
let z = &cloud.z;
for (label, alpha) in [("healthy", 1.0e-3_f64), ("collapsed", 1.0e9_f64)] {
let (mut term, _disp) = build_term(z.view(), 1, Topo::Circle, AssignmentMode::softmax(1.0));
let mut rho =
SaeManifoldRho::new(1.0e-3_f64.ln(), 1.0e-3_f64.ln(), vec![array![alpha.ln()]; 1]);
term.run_joint_fit_arrow_schur(z.view(), &mut rho, None, 40, 1.0, 1.0e-6, 1.0e-6)
.expect("inner joint fit");
let fitted = term.try_fitted().expect("fitted reconstruction");
let coord: Array1<f64> = term.assignment.coords[0].as_matrix().column(0).to_owned();
let chart = term.chart_degeneracy_report();
let project = |rows: ndarray::ArrayView2<'_, f64>| -> Vec<(f64, f64)> {
(0..rows.nrows())
.map(|i| {
let row = rows.row(i);
(row.dot(&u), row.dot(&v))
})
.collect()
};
let planted = project(z.view());
let recovered = project(fitted.view());
let extent = planted
.iter()
.chain(recovered.iter())
.fold(0.0_f64, |m, (a, b)| m.max(a.abs()).max(b.abs()))
.max(f64::MIN_POSITIVE);
const ROWS: usize = 25;
const COLS: usize = 49;
let mut grid = vec![vec![' '; COLS]; ROWS];
let mut mark = |points: &[(f64, f64)], glyph: char| {
for &(a, b) in points {
let col = (((a / extent) * 0.5 + 0.5) * (COLS - 1) as f64).round() as isize;
let row = ((0.5 - (b / extent) * 0.5) * (ROWS - 1) as f64).round() as isize;
if (0..COLS as isize).contains(&col) && (0..ROWS as isize).contains(&row) {
let cell = &mut grid[row as usize][col as usize];
*cell = if *cell == ' ' || *cell == glyph { glyph } else { '@' };
}
}
};
mark(&planted, '.');
mark(&recovered, '#');
let dispersion = chart.axes[0].dispersion;
let points = chart.axes[0].resolved_points;
let recovery = circular_recovery_r2(&coord, &cloud.theta);
eprintln!(
"[2691-ring] arm={label} alpha={alpha:.1e} circular_variance={dispersion:.6e} \
resolved_chart_points={points}/{n} recovery_R2={recovery:.4} extent={extent:.4} \
('.' planted, '#' recovered, '@' both)"
);
for row in &grid {
eprintln!("[2691-ring] {label:>9} |{}|", row.iter().collect::<String>());
}
let sample: Vec<String> = (0..n)
.step_by(n / 10)
.map(|i| format!("({:.3},{:.4})", cloud.theta[i], coord[i]))
.collect();
eprintln!("[2691-ring] {label} (theta, chart t) = {}", sample.join(" "));
match label {
"healthy" => assert!(
dispersion > 0.5 && points == n && recovery > 0.9,
"#2691: the healthy arm must trace the planted ring (circular variance \
{dispersion:.3e}, {points}/{n} chart points, recovery R2 {recovery:.4})"
),
_ => assert!(
chart.axes[0].degenerate(),
"#2691: the alpha=1e9 arm must read as degenerate in the chart's own metric \
(circular variance {dispersion:.3e}, {points}/{n} chart points)"
),
}
}
}