torch_sci_solver.torch_impl.spinless_helpers¶
Flat spin-orbital ("spinless") basis + streaming excitation tables.
A spinless Hamiltonian (GHF / spin-orbit-coupled / generalized-spinor) has no
alpha/beta factorization: the wavefunction lives over an explicit list of
N flat n_spinorb-bit determinants (dim = N), not a Cartesian product
or an (alpha, beta) pair list. This module is the flat-determinant
analogue of :mod:torch_sci_solver.torch_impl.pairs (the basis container +
initial-vector helper) and
:mod:torch_sci_solver.torch_impl.pair_helpers (the streaming excitation-
table generator) — genuinely simpler than both, since there is no per-spin
partner/uid bookkeeping to maintain: each basis row already is the unique
element, so membership testing is a single torch.searchsorted against the
sorted determinant list, with no "expand over partners sharing a spectator"
step (:func:~torch_sci_solver.torch_impl.pair_helpers._stream_same_spin_dedup's
whole reason to exist).
Excitation enumeration mirrors :func:~torch_sci_solver.torch_impl.pair_helpers.
_stream_same_spin (the non-dedup reference there): for each determinant,
enumerate every way to annihilate order occupied spin-orbitals and create
order empty ones (order=1 singles, order=2 doubles), then keep the
candidates whose excited determinant is also in the (sorted) basis.
Determinants are stored as a stacked (N, n_limbs) int64 tensor (see
:mod:torch_sci_solver.torch_impl.determinants's module docstring for the
limb convention), so n_spinorb is not capped at 64.
SpinlessSCIState
[source]
dataclass
¶
SpinlessSCIState(amplitudes: 'np.ndarray', ci_strs: 'np.ndarray', norb: int, nelec: 'tuple[int, int]')
Spinless analog of qiskit_addon_sqd.fermion.SCIState.
SCIState requires amplitudes.shape == (len(ci_strs_a), len(ci_strs_b))
-- a Cartesian alpha/beta product. A spinless basis is a single length-N
list of N-particle spin-orbital determinants; the eigenvector is a flat
length-N 1-D vector and there is one string array, not two. Mirrors
torch_sci_solver.torch_impl.pairs.PairSCIState (the pair-mode
lookalike) and sci_solvers.spinless_ci_problem.SpinlessSCIState (the
numpy/general-algebra equivalent) -- kept here rather than imported from
sci_solvers since torch_sci_solver is the standalone lower-level
package (sci_solvers depends on it, not the reverse).
SpinlessBasis
[source]
dataclass
¶
SpinlessBasis(dets: Tensor, n_spinorb: int, n_particles: int)
An explicit, sorted, deduplicated list of flat spin-orbital determinants.
Attributes:
| Name | Type | Description |
|---|---|---|
dets |
Tensor
|
sorted, deduplicated |
n_spinorb |
int
|
number of spin-orbitals ( |
n_particles |
int
|
total particle number |