tensorcircuit.fgs#

Fermion Gaussian state simulator

class tensorcircuit.fgs.FGSSimulator(L: int, filled: Optional[List[int]] = None, alpha: Optional[Any] = None, hc: Optional[Any] = None, cmatrix: Optional[Any] = None)[source]#

Bases: object

main refs: https://arxiv.org/pdf/2306.16595.pdf, https://arxiv.org/abs/2209.06945, https://scipost.org/SciPostPhysLectNotes.54/pdf

convention: for Hamiltonian (c^dagger, c)H(c, c^dagger) for correlation <(c, c^dagger)(c^dagger, c)> cā€™ = alpha^dagger (c, c^dagger)

__init__(L: int, filled: Optional[List[int]] = None, alpha: Optional[Any] = None, hc: Optional[Any] = None, cmatrix: Optional[Any] = None)[source]#

_summary_

Parameters
  • L (int) ā€“ system size

  • filled (Optional[List[int]], optional) ā€“ the fermion site that is fully occupied, defaults to None

  • alpha (Optional[Tensor], optional) ā€“ directly specify the alpha tensor as the input

  • hc (Optional[Tensor], optional) ā€“ the input is given as the ground state of quadratic Hamiltonian hc

  • cmatrix (Optional[Tensor], optional) ā€“ only used for debug, defaults to None

static chemical_potential(chi: Any, i: int, L: int) ā†’ Any[source]#
cond_measure(ind: int, status: float, with_prob: bool = False) ā†’ Any[source]#
entropy(subsystems_to_trace_out: Optional[List[int]] = None) ā†’ Any[source]#

compute von Neumann entropy for the fermion state

Parameters

subsystems_to_trace_out (Optional[List[int]], optional) ā€“ _description_, defaults to None

Returns

_description_

Return type

Tensor

evol_cp(i: int, chi: Any = 0) ā†’ None[source]#

The evolve Hamiltonian is \(chi c_i^\dagger c_i\)

Parameters
  • i (int) ā€“ _description_

  • chi (Tensor, optional) ā€“ _description_, defaults to 0

evol_ghamiltonian(h: Any) ā†’ None[source]#

Evolve as \(e^{-1/2 i \hat{h}}\) with h generally non-Hermitian

Parameters

h (Tensor) ā€“ _description_

evol_hamiltonian(h: Any) ā†’ None[source]#

Evolve as \(e^{-i/2 \hat{h}}\)

Parameters

h (Tensor) ā€“ _description_

evol_hp(i: int, j: int, chi: Any = 0) ā†’ None[source]#

The evolve Hamiltonian is \(\chi c_i^\dagger c_j +h.c.\)

Parameters
  • i (int) ā€“ _description_

  • j (int) ā€“ _description_

  • chi (Tensor, optional) ā€“ _description_, defaults to 0

evol_icp(i: int, chi: Any = 0) ā†’ None[source]#

The evolve Hamiltonian is \(chi c_i^\dagger c_i\) with \(\exp^{-H/2}\)

Parameters
  • i (int) ā€“ _description_

  • chi (Tensor, optional) ā€“ _description_, defaults to 0

evol_ihamiltonian(h: Any) ā†’ None[source]#

Evolve as \(e^{-1/2 \hat{h}}\)

Parameters

h (Tensor) ā€“ _description_

evol_sp(i: int, j: int, chi: Any = 0) ā†’ None[source]#

The evolve Hamiltonian is \(chi c_i^\dagger c_j^\dagger +h.c.\)

Parameters
  • i (int) ā€“ _description_

  • j (int) ā€“ _description_

  • chi (Tensor, optional) ā€“ _description_, defaults to 0

expectation_2body(i: int, j: int) ā†’ Any[source]#

expectation of two fermion terms convention: (c, c^dagger) for i>L, c_{i-L}^dagger is assumed

Parameters
  • i (int) ā€“ _description_

  • j (int) ā€“ _description_

Returns

_description_

Return type

Tensor

expectation_4body(i: int, j: int, k: int, l: int) ā†’ Any[source]#

expectation of four fermion terms using Wick Thm convention: (c, c^dagger) for i>L, c_{i-L}^dagger is assumed

Parameters
  • i (int) ā€“ _description_

  • j (int) ā€“ _description_

  • k (int) ā€“ _description_

  • l (int) ā€“ _description_

Returns

_description_

Return type

Tensor

classmethod fermion_diagonalization(hc: Any, L: int) ā†’ Tuple[Any, Any, Any][source]#
classmethod fermion_diagonalization_2(hc: Any, L: int) ā†’ Tuple[Any, Any, Any][source]#
get_alpha() ā†’ Any[source]#
get_bogoliubov_uv() ā†’ Tuple[Any, Any][source]#
get_cmatrix() ā†’ Any[source]#
get_cmatrix_majorana() ā†’ Any[source]#

correlation matrix defined in majorana basis convention: \(gamma_0 = c_0 + c_0^\dagger\) \(gamma_1 = i(c_0 - c_0^\dagger)\)

Returns

_description_

Return type

Tensor

get_covariance_matrix() ā†’ Any[source]#
get_reduced_cmatrix(subsystems_to_trace_out: List[int]) ā†’ Any[source]#
static hopping(chi: Any, i: int, j: int, L: int) ā†’ Any[source]#
static init_alpha(filled: List[int], L: int) ā†’ Any[source]#
orthogonal() ā†’ None[source]#
overlap(other: tensorcircuit.fgs.FGSSimulator) ā†’ Any[source]#

overlap upto a U(1) phase

Parameters

other (FGSSimulator) ā€“ _description_

Returns

_description_

Return type

_type_

post_select(i: int, keep: int = 1) ā†’ None[source]#

post select (project) the fermion state to occupation eigenstate <n_i> = keep

Parameters
  • i (int) ā€“ _description_

  • keep (int, optional) ā€“ _description_, defaults to 1

renyi_entropy(n: int, subsystems_to_trace_out: List[int]) ā†’ Any[source]#

compute renyi_entropy of order n for the fermion state

Parameters
  • n (int) ā€“ _description_

  • subsystems_to_trace_out (List[int]) ā€“ system sites to be traced out

Returns

_description_

Return type

Tensor

static sc_pairing(chi: Any, i: int, j: int, L: int) ā†’ Any[source]#
static wmatrix(L: int) ā†’ Any[source]#
class tensorcircuit.fgs.FGSTestSimulator(L: int, filled: Optional[List[int]] = None, state: Optional[Any] = None, hc: Optional[Any] = None)[source]#

Bases: object

Never use, only for correctness testing stick to numpy backend and no jit/ad/vmap is available

__init__(L: int, filled: Optional[List[int]] = None, state: Optional[Any] = None, hc: Optional[Any] = None)[source]#
static chemical_potential_jw(chi: Any, i: int, L: int) ā†’ Any[source]#
cond_measure(ind: int, status: float, with_prob: bool = False) ā†’ Any[source]#
entropy(subsystems_to_trace_out: Optional[List[int]] = None) ā†’ Any[source]#
evol_cp(i: int, chi: Any = 0) ā†’ None[source]#
evol_ghamiltonian(h: Any) ā†’ None[source]#
evol_hamiltonian(h: Any) ā†’ None[source]#
evol_hp(i: int, j: int, chi: Any = 0) ā†’ None[source]#
evol_icp(i: int, chi: Any = 0) ā†’ None[source]#
evol_ihamiltonian(h: Any) ā†’ None[source]#
evol_sp(i: int, j: int, chi: Any = 0) ā†’ None[source]#
expectation_4body(i: int, j: int, k: int, l: int) ā†’ Any[source]#
classmethod fermion_diagonalization(hc: Any, L: int) ā†’ Any[source]#
get_cmatrix() ā†’ Any[source]#
get_cmatrix_majorana() ā†’ Any[source]#
get_dm() ā†’ Any[source]#
static get_hmatrix(hc: Any, L: int) ā†’ Any[source]#
static hopping_jw(chi: Any, i: int, j: int, L: int) ā†’ Any[source]#
static init_state(filled: List[int], L: int) ā†’ Any[source]#
orthogonal() ā†’ None[source]#
overlap(other: tensorcircuit.fgs.FGSTestSimulator) ā†’ Any[source]#
post_select(i: int, keep: int = 1) ā†’ None[source]#
product(other: tensorcircuit.fgs.FGSTestSimulator) ā†’ Any[source]#
renyi_entropy(n: int, subsystems_to_trace_out: List[int]) ā†’ Any[source]#
static sc_pairing_jw(chi: Any, i: int, j: int, L: int) ā†’ Any[source]#
tensorcircuit.fgs.onehot_matrix(i: int, j: int, N: int) ā†’ Any[source]#