pytc.df.thcΒΆ

Production DF/THC algebra and X-store layouts.

The JAX section implements the panelled LS-THC algebra used by the solver. extract_vv_df_factor builds its metric-applied virtual DF input. The X-store section converts ISDF X factors between the rank-innermost store layout (nmo, nmo, rank) and the rank-major layout (rank, nmo, nmo) (panel-contiguous), in place or into a new store.

Classes

ScalableDirectSandwichesJax

Exact, cross, full-THC, and robust production contractions.

Functions

_as_fp64_host

FP64 as a HOST array -- for operands the panel loops only ever slice.

_as_fp64_jax

Validate rank while landing an operand on device as float64.

_convert_x_dataset

_x_source_stamp

Provenance stamp for an X dataset: sha256 over shape plus EVERY row slab, so any changed entry changes the stamp (no sampling shortcuts).

add_rank_major

Append a rank-major copy of X to an existing store, in place.

convert_store_to_rank_major

Whole-store conversion: every dataset copied; X kept AND a rank-major twin appended.

convert_x_to_rank_major

Convert one X dataset to rank-major layout, chunked over an nmo axis.

df_sandwiches_jax

Evaluate the panelled production DF/THC contractions.

exact_df_panelled

Exact current-DF sandwich, panelled over the auxiliary axis.

extract_vv_df_factor

Extract PySCF's metric-applied virtual DF factor in PyTC order.

fit_lsthc_jax

JAX FP64 normal-equation LS-THC fit with host-resident DF factors.

full_thc_panelled

B_tilde[a,c,Q] B_tilde[b,d,Q] t2[ij,c,d] without ever forming B_tilde.

partial_thc_crosses_panelled

Both partial-THC crosses with a precontracted DF endpoint.

require_float64

Fail closed if JAX is not in x64 mode.