pytc.solver.bug_tΒΆ

BUG-(T): perturbative triples from the factorized T2 alone.

E(T) is evaluated without ever forming T3 or the W intermediate. The doubles arrive from the BUG solver already factored as t2 = U S U^T, and (T) is built by projecting into that pair basis, dividing by the denominator exactly in the projected space, and contracting the r x r x r cores.

Cost: N^5 to assemble the cores, N^6 for the energy contraction, N^4 memory. Canonical (T) is N^7.

Contraction orders are written out by hand, one chain per permutation class.

The energy path uses explicit packed GEMMs. The two inverse cycles and three transpositions are fused by linearity in their permuted C_hat operand, reducing the expensive chains from seven to three. Occupied blocks of the packed pair-overlap matrix are streamed with lax.scan so XLA can reuse their storage.

Functions

_energy_layout

_energy_pair_block

core_V

Projected V core.

core_W

Projected W core C[x,x',x''], independently validated to 1e-15.

core_W_blocked

Projected W core, streaming the Q-carried N^4 G/H tensors in aux blocks.

energy

Fused (T) energy from the W core and the divided core C_hat.

energy_cycle

Identity plus inverse-cycle phase of the prepared GPU energy.

energy_prepared

energy_trans

Transposition phase of the prepared GPU energy.

low_rank_t

prepare_energy

The symmetrised W core, the two folded C_hat operands and the identity term.

sylvester_divide

Divide the core by D = d_P + d_Q + d_R exactly, in the projected space.

symmetrize_core_W

Return the sum, rather than the average, of all six permutations.