pytc.solver.bug_core

Shared machinery of the basis-update & Galerkin (BUG) low-rank solvers.

The result type, the stopping rule, truncation of the Galerkin core, DF factor extraction, and the device kernels of the augment–Galerkin–truncate loop: blocked products, row panels streamed from host memory, orthogonalisation and counted host<->device transfers. The dependency runs one way only: methods -> bug_core. Nothing here imports from the individual solvers.

Classes

LowRankResult

What every BUG solver returns.

TruncInfo

Exceptions

Float64NotEnabled

Raised when JAX is not in x64 mode: a float32 run agrees with any reference to ~1e-7, which looks like success rather than an error.

Functions

amplitude_step

(||U' diag(S') U'^T - U diag(S) U^T||_F, valid) with cross = U'^T U.

check_stop

The stop rule of every BUG solver; returns the reason, or None to go on.

energy_plateau

The last window energy changes are all below tol.

extract_df_factors

PySCF DF 3-index MO factors B[p,q,Q] for the oo, ov and vv blocks.

hostbacked_basis_update

Updated basis written to the HOST, with the cross accumulated in flight.

orth_directions

Rank-revealing QR of projected directions, optionally consuming W.

plateau_tol

Energy change below which the iteration has settled under the cut.

project_directions

Project and optionally select augmentation directions once.

rank_cut

(order, r): core modes by decreasing weight and how many rule keeps.

requested_aug_width

Columns the augmentation selector will ask for at this rank.

require_float64

Fail closed unless JAX actually produces float64 (JAX_ENABLE_X64=1).

run_dense

fn(*args) for a dense core step, on the device or on the host CPU as chosen.

sylvester

Solve A X + X A = G for symmetric A via the symmetric eig route.

truncate_sym

Tolerance-truncate a symmetric core M.