quantax.model.SingletPair#

class quantax.model.SingletPair#

Singlet paired wavefunction \(\psi(n) = \mathrm{det}(n_\uparrow \star F \star n_\downarrow)\). Only works for spinful systems with equal number of spin-up and spin-down particles.

__init__(F: Array | None = None, sublattice: Translation | tuple[int, ...] | None = None, dtype: str | type[Any] | dtype | SupportsDType | None = None, out_dtype: str | type[Any] | dtype | SupportsDType | None = None)#

Initialize the SingletPair model.

Parameters:
  • F – The pairing matrix. If None, it will be initialized as paired Fermi sea orbitals.

  • sublattice – The sublattice structure.

  • dtype – The data type for orbital parameters.

  • out_dtype – The data type for computations and outputs. When dtype is real and out_dtype is complex, F stores the real and imaginary parts using real numbers.

__call__(s: Array) → LogArray#

Usual forward pass without internal quantities.

property use_ref: bool#

Whether to use reference implementation for local updates. Default to True.

property F_full: Array#

Return the full pairing matrix.

init_internal(s: Array) → tuple[LogArray, MF_Internal]#

Return wavefunction and internal values for given input configurations. See RefModel for details.

property required_update_modes: tuple[str, ...]#

The required update modes for accelerated ref_forward pass. ("nflips",) for spin systems, and ("nflips_up", "nflips_dn") for spinful fermions, where the numbers of flipped spin-up and spin-down modes are needed separately to determine the row and column updates.

ref_forward(s: Array, s_old: Array, update_mode: dict[str, Any], internal: MF_Internal, return_update: Literal[False] = False) → LogArray#
ref_forward(s: Array, s_old: Array, update_mode: dict[str, Any], internal: MF_Internal, return_update: Literal[True]) → tuple[LogArray, MF_Internal]

Accelerated forward pass through local updates and internal quantities. See RefModel for details.

The determinant \(\mathrm{det}(n_\uparrow \star F \star n_\downarrow)\) gets row updates from spin-up hoppings and column updates from spin-down hoppings. The update modes are treated as upper bounds of the number of flips, and unused hop slots are no-ops.