Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.haiqu.ai/llms.txt

Use this file to discover all available pages before exploring further.

haiqu.sdk.skqd.get_orbital_rotation(norb)

Build the orbital rotation matrix for the SIAM model. Constructs a unitary matrix C that transforms Hamiltonian tensors from site basis to momentum basis via rotate_basis(h1e, h2e, C^dagger). The ground state of the Anderson impurity model is significantly sparser in momentum basis, making SQD sampling more effective. The rotation:
  1. Diagonalizes the bath hopping chain (sites 1..norb-1) to obtain momentum eigenstates of the non-interacting bath.
  2. Leaves the impurity orbital (site 0) unchanged.
  3. Permutes the impurity to the center of the orbital ordering so that the on-site interaction sits at index (norb - 1) // 2 in the new basis.
  • Parameters: norb (int) — Number of spatial orbitals (impurity + bath sites).
  • Returns: Unitary rotation matrix C, shape (norb, norb). Use as:
    h1e_mom, h2e_mom = rotate_basis(h1e, h2e, C.T.conj())
    
  • Return type: ndarray

haiqu.sdk.skqd.rotate_basis(h1e, h2e, orbital_rotation)

Rotate the orbital basis of one- and two-body Hamiltonian tensors. Applies the unitary transformation:
h1e'[A,B]       = sum_{a,b} U[A,a] * h1e[a,b] * U*[B,b]
h2e'[A,B,C,D]   = sum_{a,b,c,d} U[A,a] * U*[B,b] * U[C,c] * U*[D,d] * h2e[a,b,c,d]
where U = orbital_rotation and U* is its complex conjugate.
  • Parameters:
    • h1e (ndarray) — One-body tensor, shape (norb, norb).
    • h2e (ndarray) — Two-body tensor, shape (norb, norb, norb, norb).
    • orbital_rotation (ndarray) — Unitary matrix U, shape (norb, norb).
  • Returns: (h1e_rotated, h2e_rotated) in the new basis.
  • Return type: tuple[ndarray, ndarray]

class haiqu.sdk.skqd.SKQDOptions(*, samples_per_batch=100, num_batches=5, max_iterations=15, symmetrize_spin=True, configuration_recovery=False, seed=None)

Options for SQD postprocessing (server-side diagonalization). These parameters control the classical SQD algorithm, not circuit generation. Circuit parameters (krylov_dim, dt) are passed directly to the circuit builder functions.
  • Parameters:
    • samples_per_batch (int) — Number of bitstring samples per SQD batch.
    • num_batches (int) — Number of subsampling batches for SQD.
    • max_iterations (int) — Maximum number of SQD self-consistent iterations.
    • symmetrize_spin (bool) — Whether to enforce spin symmetry in SQD.
    • configuration_recovery (bool) — Whether to apply configuration recovery to refine noisy bitstrings using orbital occupancy information. See Configuration recovery for what this does and when to use it.
    • seed (int | None) — Random seed for reproducibility.