atlas_q.truncation.choose_rank_from_sigma#

atlas_q.truncation.choose_rank_from_sigma(S, eps_bond, chi_cap, budget_ok=<function <lambda>>)[source]#

Adaptive rank selection from singular values

Args:

S: Singular values (sorted descending) eps_bond: Energy tolerance (truncation threshold) chi_cap: Maximum allowed rank for this bond budget_ok: Function that checks if rank k is within memory budget

Returns:

k: Selected rank eps_local: Local truncation error entropy: Entanglement entropy at this bond condS: Condition number (σ_max / σ_k)

Strategy: 1. Find k_tol from energy criterion: cumulative energy ≥ (1-ε²) * total 2. Cap by chi_max_per_bond 3. Reduce if budget violation 4. Compute diagnostics (entropy, condition number, error)