Skip to content

tencirlab.fermion

Source · Used by: Figure 2(a,b) · 6×6 PEPS versus exact densities

Number-conserving free-fermion (Slater determinant) states in the occupation basis: exact amplitudes and exact Born sampling, as references for variational states.

A state of N fermions on L modes is given by orthonormal orbitals U of shape (L, N), |U> = prod_k (sum_i U[i, k] c_i^dag) |0>. Configurations are 0/1 occupation vectors s with basis state c_{i_1}^dag ... c_{i_N}^dag |0>, i_1 < ... < i_N, which is the Jordan-Wigner order of TenCirPauli.

slater_amplitude

slater_amplitude(orbitals: Array, s: Array) -> jax.Array

<s|U> = det U[occupied rows].

Source code in tencirlab/fermion.py
15
16
17
18
19
def slater_amplitude(orbitals: jax.Array, s: jax.Array) -> jax.Array:
    """``<s|U> = det U[occupied rows]``."""
    n = orbitals.shape[1]
    occupied = jnp.sort(jnp.argsort(-s, stable=True)[:n])
    return jnp.linalg.det(orbitals[occupied])

slater_sample

slater_sample(orbitals: Array, key: Array) -> jax.Array

One configuration drawn from |<s|U>|^2, measuring the modes in order.

Conditioning on n_i updates the correlation matrix C = U U^dag of the unmeasured modes by Wick's theorem, C -= C[:, i] C[i, :] / C[i, i] for n_i = 1 and C += C[:, i] C[i, :] / (1 - C[i, i]) for n_i = 0.

Source code in tencirlab/fermion.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def slater_sample(orbitals: jax.Array, key: jax.Array) -> jax.Array:
    """
    One configuration drawn from ``|<s|U>|^2``, measuring the modes in order.

    Conditioning on ``n_i`` updates the correlation matrix ``C = U U^dag`` of the
    unmeasured modes by Wick's theorem, ``C -= C[:, i] C[i, :] / C[i, i]`` for
    ``n_i = 1`` and ``C += C[:, i] C[i, :] / (1 - C[i, i])`` for ``n_i = 0``.
    """
    size = orbitals.shape[0]
    u = jax.random.uniform(key, (size,))

    def measure(c, i):
        p = jnp.clip(c[i, i].real, 0.0, 1.0)
        n = u[i] < p
        column = c[:, i]
        c = c + jnp.where(n, -1 / p, 1 / (1 - p)) * jnp.outer(column, column.conj())
        mask = jnp.arange(size) != i
        return c * (mask[:, None] & mask[None, :]), n.astype(jnp.int32)

    _, s = jax.lax.scan(measure, orbitals @ orbitals.conj().T, jnp.arange(size))
    return s

History

Date Pull request Kind Change
2026-12-01 #10 migration Fermionic PEPS–tVMC corner quench