Skip to content

Transformation library

Indexed by what a step does. Every builder takes the two parameter namespaces it relates.

transformations

The transformation library, indexed by the effect of a transformation.

Module Effect Exactness
truncations an infinite degree of freedom is made finite approximate, declared regime
basis_changes the Hamiltonian is rewritten in different operators exact
encodings the Hamiltonian is rewritten in another algebra exact on the encoded subspace
reparametrisations the model is restated by different parameters exact
perturbative hardware knobs related to an effective theory approximate, declared regime
trotterisation a Hamiltonian to a product of unitaries approximate, resource-controlled

Every builder takes the two parameter namespaces it relates. None of these modules imports a solver: each declares equations, solved forms, validity conditions and, for a hardware model as target, an admissible knob set.

base

Base classes of the transformations in the library.

NamespacedTransformation adds the two parameter namespaces a library transformation relates. ModelTransformation adds the common application: the target model is built at the mapped chain length, the dropped constants are forwarded, and the parameters determined by the solved forms of the relation are bound. A transformation defined outside the library need not subclass either class; Transformation is the contract.

NamespacedTransformation dataclass

Bases: Transformation

A transformation between two models, each of which owns one parameter namespace.

Attributes:

Name Type Description
source_namespace Namespace

the namespace of the model consumed.

target_namespace Namespace

the namespace of the model produced.

target_name str

the name of the model produced, which is the name of its artifact in the model graph.

matter_sites staticmethod
matter_sites(artifact: Artifact) -> int

The chain length of the structural type of an artifact.

ModelTransformation dataclass

Bases: NamespacedTransformation

A transformation whose target is a Hamiltonian model built by the model library.

Subclasses implement build_target; the structural type of the target and the application follow from it.

build_target abstractmethod
build_target(matter_sites: int) -> HamiltonianModel

The target model at the given target chain length, with its parameters unbound.

target_structure
target_structure(source: StructureType) -> StructureType

The structural type of the built target; a basis change returns source instead.

truncations

Truncations: an infinite-dimensional degree of freedom is made finite.

A truncation is approximate and valid within a declared regime: the discarded states are removed from the model, and no resource parameter reduces the error.

QuantumLinkTruncation dataclass

Bases: ModelTransformation

The quantum-link truncation of a compact U(1) gauge field to a spin-1/2 on every link.

U_{l,l+1} -> -i (2/sqrt(3)) S^+_{l,l+1}       E_{l,l+1} -> e S^z_{l,l+1}

The electric term becomes the constant (N-1) a e^2 / 8, which is dropped and recorded on the target; then e -> 1 and a -> 1. The relation carries only the mass and releases kappa as a free parameter from this level downwards.

Attributes:

Name Type Description
convention QuantumLinkConvention

the quantum-link convention produced; the uniform substitution yields the staggered convention (hopping coupling, staggered mass).

build_target
build_target(matter_sites: int) -> HamiltonianModel

The quantum-link model with spin-1/2 links.

dropped_constant_at
dropped_constant_at(source: Artifact) -> DroppedConstant

The constant (a/2) sum_l E^2 -> (N-1) a e^2 / 8, evaluated at the source binding.

quantum_link_truncation(
    source: Namespace,
    target: Namespace,
    *,
    convention: QuantumLinkConvention = STAGGERED_CONVENTION,
    target_name: str = "H_QLM",
    name: str = "spin-1/2 quantum-link truncation",
    field_sector_threshold: float = DEFAULT_FIELD_SECTOR_THRESHOLD,
) -> QuantumLinkTruncation

Build a spin-1/2 quantum-link truncation between two namespaces.

Parameters:

Name Type Description Default
source Namespace

the namespace of the untruncated theory, which supplies m and electric_gap.

required
target Namespace

the namespace of the truncated model, which owns m and kappa.

required
convention QuantumLinkConvention

the quantum-link convention to produce.

STAGGERED_CONVENTION
target_name str

the name of the model produced.

'H_QLM'
name str

the name of the transformation.

'spin-1/2 quantum-link truncation'
field_sector_threshold float

the threshold of the regime condition kappa << electric_gap.

DEFAULT_FIELD_SECTOR_THRESHOLD

Returns:

Type Description
QuantumLinkTruncation

The transformation.

basis_changes

Exact basis changes: the particle-hole transformation and two Jordan-Wigner transformations.

Each rewrites a Hamiltonian in different operators; the operator form of the target is unitarily equivalent to that of the source, and the spectrum is preserved. None of them changes the abstraction level.

ParticleHoleTransformation dataclass

Bases: ModelTransformation

The particle-hole transformation on the odd matter sites and the even links.

on matter sites l = 1, 3, 5, ... (odd):     n_l -> 1 - n_l,  psi_l -> psi^dag_l
on links (l, l+1) with l = 0, 2, ... (even): S^z -> -S^z,    S^+- -> S^-+

Exact and unitary: the hopping coupling becomes the pair coupling, and the mass staggering cancels into the retained constant of staggering_constant. The two parities must be opposite; this choice passes +m to the target, the other -m.

Attributes:

Name Type Description
convention QuantumLinkConvention

the quantum-link convention produced, which is the homogeneous convention.

target_structure
target_structure(source: StructureType) -> StructureType

The structural type, name included, is unchanged.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The homogeneous quantum-link model, carrying the staggering constant.

image
image(source: HamiltonianModel) -> OperatorSum

The source rewritten under the particle-hole transformation, on the same register.

On the odd matter sites n -> 1 - n and psi <-> psi^dag; on the even links S^z -> -S^z and S^+- -> -S^-+. The latter includes the z rotation that removes the (-1)**(l+1) sign of the pair coupling.

JordanWignerToQubits dataclass

Bases: ModelTransformation

The Jordan-Wigner transformation of the matter fermions of a quantum-link model to qubits.

psi^dag_l psi_l  ->  (sigma^z_{2l} + 1) / 2      S^+-_{l,l+1}  ->  sigma^+-_{2l+1}
psi_l psi_{l+1}  ->  sigma^-_{2l} sigma^-_{2l+2}  S^z_{l,l+1}   ->  sigma^z_{2l+1} / 2

Exact. The Jordan-Wigner string runs over the matter sites only and the coupling joins adjacent ones, so it reduces to a sign: +1 for the pair coupling, -1 for the hopping coupling under the convention of qsimod.realise.build.

Attributes:

Name Type Description
convention QuantumLinkConvention

the quantum-link convention of the source.

retain_staggering_constant bool

whether the constant -m * floor(N/2) carried by the source is added to the target.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The image on the qubit register.

image
image(source: HamiltonianModel) -> OperatorSum

The Jordan-Wigner image of the source on the qubit register.

JordanWignerToFermions dataclass

Bases: ModelTransformation

The Jordan-Wigner transformation of a spin-1/2 chain to spinless fermions.

S^+_j -> c^dag_j prod_{k<j} (1 - 2 n_k)        S^z_j -> n_j - 1/2

The transformation is exact. The transverse term becomes a hopping term, and the ZZ term becomes a nearest-neighbour interaction, a chemical potential and a constant; the strings cancel because the couplings join adjacent sites.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The interacting spinless-fermion chain.

image
image(source: HamiltonianModel) -> OperatorSum

The source spin chain rewritten in fermions, on the same sites.

S^+_j -> (-1)**j prod_{k<j} (1 - 2 n_k) c^dag_j      S^z_j -> n_j - 1/2

The map is the inverse of the Jordan-Wigner convention of qsimod.realise.build, with every site fermionic.

carried_over

carried_over(
    source: Namespace, target: Namespace, *locals_: str
) -> ParameterRelation

An identity relation on the named local parameters between two namespaces.

staggering_constant

staggering_constant(
    matter_sites: int, mass: Scalar
) -> Scalar

The constant -m * floor(N/2) that n_l -> 1 - n_l on the odd sites leaves behind.

parity_string

parity_string(sites: Sequence[int]) -> OperatorSum

The Jordan-Wigner string prod_q P_q, P = 1 - 2n, over the given register sites.

The result is one word of len(sites) parity factors; the normal form expands a parity only where a site retains an odd number of them.

jordan_wigner_ladder

jordan_wigner_ladder(
    position: int,
    string_sites: Sequence[int],
    ladder: SiteOperator,
) -> OperatorSum

A fermionic ladder operator at Jordan-Wigner position p as (-1)**p (prod P) ladder.

The convention is that of qsimod.realise.build: the plain Jordan-Wigner transformation with alternating minus signs, the string running over the sites with a strictly smaller position. ladder is the two-level operator that represents psi or psi^dag in the target algebra, that is sigma^-+ on a qubit, or, in the inverse direction, c or c^dag representing a spin S^-+.

fermions_to_qubits_image

fermions_to_qubits_image(
    source: HamiltonianModel,
) -> OperatorSum

The Jordan-Wigner image of a fermion/spin-1/2 model on a qubit register.

psi_l -> (-1)**p prod_{q<p} (1 - 2 n_q) sigma^-_l      n_l -> n_l
S^+- -> sigma^+-                                        S^z -> Z / 2

where p is the position of the fermionic site l in ascending site order. The register positions are unchanged.

particle_hole_transformation

particle_hole_transformation(
    source: Namespace,
    target: Namespace,
    *,
    target_name: str = "H_QLM",
    name: str = "particle-hole transformation",
) -> ParticleHoleTransformation

Build a particle-hole transformation between two namespaces.

Parameters:

Name Type Description Default
source Namespace

the namespace of the staggered model.

required
target Namespace

the namespace of the homogeneous model.

required
target_name str

the name of the model produced.

'H_QLM'
name str

the name of the transformation.

'particle-hole transformation'

Returns:

Type Description
ParticleHoleTransformation

The transformation.

jordan_wigner_to_qubits

jordan_wigner_to_qubits(
    source: Namespace,
    target: Namespace,
    *,
    convention: QuantumLinkConvention = HOMOGENEOUS_CONVENTION,
    retain_staggering_constant: bool = True,
    target_name: str = "H_qubit",
    name: str = "Jordan-Wigner to qubits",
) -> JordanWignerToQubits

Build a Jordan-Wigner transformation to an interleaved qubit register.

Parameters:

Name Type Description Default
source Namespace

the namespace of the fermion-spin model.

required
target Namespace

the namespace of the qubit model.

required
convention QuantumLinkConvention

the quantum-link convention of the source.

HOMOGENEOUS_CONVENTION
retain_staggering_constant bool

whether the source carries the staggering constant.

True
target_name str

the name of the model produced.

'H_qubit'
name str

the name of the transformation.

'Jordan-Wigner to qubits'

Returns:

Type Description
JordanWignerToQubits

The transformation.

jordan_wigner_to_fermions

jordan_wigner_to_fermions(
    source: Namespace,
    target: Namespace,
    *,
    target_name: str = "H_tV",
    name: str = "Jordan-Wigner to spinless fermions",
) -> JordanWignerToFermions

Build a Jordan-Wigner transformation from a spin-1/2 chain to spinless fermions.

Parameters:

Name Type Description Default
source Namespace

the namespace of the spin chain, which carries Jxy and Jz.

required
target Namespace

the namespace of the fermion chain, which carries the same two parameters.

required
target_name str

the name of the model produced.

'H_tV'
name str

the name of the transformation.

'Jordan-Wigner to spinless fermions'

Returns:

Type Description
JordanWignerToFermions

The transformation.

encodings

Encodings: the degrees of freedom of one algebra are rewritten in another algebra.

An encoding is exact on the encoded subspace: the operator identities hold as A = P B P, and the target model declares the projector P onto the declared occupation subspace.

HardcoreBosonEncoding dataclass

Bases: ModelTransformation

The boson encoding of spin-1/2 degrees of freedom by the two lowest bosonic occupations.

sigma^-_l = P_l a_l P_l                 S^- = (1/sqrt(2)) P d^2 P
sigma^z_l = P_l (2 a^dag_l a_l - 1) P_l  S^z = (1/2) P (d^dag d - 1) P

Matter positions carry n in {0, 1} and link positions n in {0, 2}, so a numerical realisation needs an occupation cutoff of at least two.

Attributes:

Name Type Description
retain_staggering_constant bool

whether the constant -m * floor(N/2) carried by the source is added to the target.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The encoded bosonic model.

image
image(source: HamiltonianModel) -> OperatorSum

The Jordan-Wigner image on qubits in normal form, followed by the boson encoding.

qubits_to_bosons_image

qubits_to_bosons_image(
    qubit_hamiltonian: OperatorSum, source: HamiltonianModel
) -> OperatorSum

The bosonic encoding of a qubit-register Hamiltonian, exact on the encoded subspace.

matter (n in {0, 1}):  sigma^- -> a              sigma^+ -> a^dag              Z -> 2n - 1
link   (n in {0, 2}):  sigma^- -> d^2 / sqrt 2   sigma^+ -> (d^dag)^2 / sqrt 2   Z -> n - 1

where X = sigma^+ + sigma^-, Y = -i (sigma^+ - sigma^-) and n = (1 + Z)/2 on the qubit side. The identities hold as P B P. The map is linear with one factor per site and is therefore applied to a sum already in the normal form of the qubit algebra. source determines which register sites are matter sites (fermions) and which are links (spins).

hardcore_boson_encoding

hardcore_boson_encoding(
    source: Namespace,
    target: Namespace,
    *,
    retain_staggering_constant: bool = True,
    target_name: str = "H_eff",
    name: str = "Jordan-Wigner + hardcore-boson encoding",
) -> HardcoreBosonEncoding

Build a hardcore-boson encoding between two namespaces.

Parameters:

Name Type Description Default
source Namespace

the namespace of the quantum-link model.

required
target Namespace

the namespace of the bosonic model.

required
retain_staggering_constant bool

whether the source carries the staggering constant.

True
target_name str

the name of the model produced.

'H_eff'
name str

the name of the transformation.

'Jordan-Wigner + hardcore-boson encoding'

Returns:

Type Description
HardcoreBosonEncoding

The transformation.

reparametrisations

Exact reparametrisations: the same Hamiltonian stated by different parameters.

An application model is stated by an energy scale and dimensionless parameters; the derivation from a hardware model produces energies. The relation is CLOSED_FORM in both directions, that is invertible: one equation carries the energy scale across, and one equation per dimensionless parameter states that the target energy is the product of that parameter and the scale.

Reparametrisation dataclass

Bases: ModelTransformation

A transformation that restates a model by different parameters and keeps its operators.

target_structure
target_structure(source: StructureType) -> StructureType

The structural type, name included, is unchanged.

image
image(source: HamiltonianModel) -> OperatorSum

The source Hamiltonian itself, since a reparametrisation changes no operator.

AnisotropyResolution dataclass

Bases: Reparametrisation

The resolution of the anisotropy of an XXZ magnet into a second coupling energy.

Jxy -> Jxy        (carried over)
Jz  =  Delta * Jxy
build_target
build_target(matter_sites: int) -> HamiltonianModel

The XXZ chain carrying two coupling energies.

FieldResolution dataclass

Bases: Reparametrisation

The resolution of the two dimensionless fields of an Ising chain into energies.

Jz    -> Jz               (carried over)
Gamma =  hx * Jz
B     =  hz * Jz
build_target
build_target(matter_sites: int) -> HamiltonianModel

The Ising chain carrying three energies.

anisotropy_resolution

anisotropy_resolution(
    source: Namespace,
    target: Namespace,
    *,
    target_name: str = "H_XXZ",
    name: str = "anisotropy resolution",
) -> AnisotropyResolution

Build an anisotropy resolution between two namespaces.

Parameters:

Name Type Description Default
source Namespace

the namespace of the magnet as stated, with Jxy and Delta.

required
target Namespace

the namespace of the two-coupling form, with Jxy and Jz.

required
target_name str

the name of the model produced.

'H_XXZ'
name str

the name of the transformation.

'anisotropy resolution'

Returns:

Type Description
AnisotropyResolution

The transformation.

field_resolution

field_resolution(
    source: Namespace,
    target: Namespace,
    *,
    target_name: str = "H_Ising",
    name: str = "field resolution",
) -> FieldResolution

Build a field resolution between two namespaces.

Parameters:

Name Type Description Default
source Namespace

the namespace of the magnet as stated, with Jz, hz and hx.

required
target Namespace

the namespace of the three-energy form, with Jz, B and Gamma.

required
target_name str

the name of the model produced.

'H_Ising'
name str

the name of the transformation.

'field resolution'

Returns:

Type Description
FieldResolution

The transformation.

perturbative

Perturbative reductions: the knobs of a hardware model related to an effective theory.

Each relation carries the forward direction of the derivation, from the hardware parameters to the effective parameters, as closed forms, and is UNDER_DETERMINED in the inverse direction, which is therefore posed as a solve for the knob settings. Every transformation is APPROXIMATE and valid within a declared regime. Three reductions are provided: an optical superlattice realising a gauge theory, a two-component lattice realising a Heisenberg magnet, and a tilted lattice realising an Ising chain.

Reduction dataclass

Bases: ModelTransformation

A perturbative transformation from an effective theory to a hardware model.

Applying the transformation returns the hardware model unbound: the relation is under-determined in this direction, and the knob settings are determined by a solve.

Attributes:

Name Type Description
admissible_set AdmissibleSet | None

the admissible knob set of the hardware, attached to the hardware model produced.

SecondOrderPerturbationTheory dataclass

Bases: Reduction

Second-order degenerate perturbation theory on an optical superlattice.

m = delta - U/2
kappa = sqrt(2) J^2 [ 1/(delta+Delta) + 1/(delta-Delta)
                    + 1/(U-delta+Delta) + 1/(U-delta-Delta) ]

The relations are derived in the |101> <-> |020> manifold of each three-site block, which is not the ground-state manifold. In the case study this is the step from H_IR3 to H_sim, solved for the knob settings Theta_sim = {J, U, delta, Delta}.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The tilted Bose-Hubbard chain, with the admissible knob set of the hardware.

SuperexchangeReduction dataclass

Bases: Reduction

Second-order superexchange on a two-component optical lattice.

Jxy = -4 t^2 / U_ud
Jz  =  4 t^2 / U_ud - ( 4 t^2 / U_uu + 4 t^2 / U_dd )

The relations are derived in the one-atom-per-site manifold, which on the attractive branch lies above the doubly occupied states.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The two-component Bose-Hubbard chain, with the admissible knob set of the hardware.

DipoleReduction dataclass

Bases: Reduction

The resonant dipole reduction: a tilted Mott insulator realising an Ising chain.

Jz    = U
Gamma = 2 sqrt(2) J
B     = Jz - (Delta - U)

A dipole on bond j, that is an atom moved down the tilt onto its neighbour, is a spin down; the nearest-neighbour exclusion is the antiferromagnetic coupling, and the tunnelling is the transverse field. There is one spin per bond, so a register of 2N-1 sites carries 2N-2 spins. The relation has three equations against four knobs, and the superlattice is left free.

lattice_sites staticmethod
lattice_sites(spins: int) -> int

The chain length N whose register of 2N-1 sites carries spins bonds.

Raises:

Type Description
ValueError

if spins is odd.

target_sites
target_sites(source_sites: int) -> int

One spin per bond: 2N-2 spins correspond to the register of 2N-1 sites.

build_target
build_target(matter_sites: int) -> HamiltonianModel

The tilted Bose-Hubbard chain at the chain length given by target_sites.

pole_sum

pole_sum(namespace: Namespace) -> Scalar

The pole sum of the coupling map.

1/(delta+Delta) + 1/(delta-Delta) + 1/(U-delta+Delta) + 1/(U-delta-Delta), whose four denominators are the energy offsets of the intermediate configurations.

second_order_coupling

second_order_coupling(namespace: Namespace) -> Scalar

The coupling in the forward direction of the derivation.

kappa = sqrt(2) J**2 * <pole sum>, quadratic in the tunnelling rate J.

second_order_mass

second_order_mass(namespace: Namespace) -> Scalar

The mass in the forward direction of the derivation, m = delta - U/2.

The mass is the detuning from the resonance U = 2 delta.

superlattice_validity

superlattice_validity(
    effective: Namespace,
    device: Namespace,
    *,
    much_less_threshold: float = DEFAULT_MUCH_LESS_THAN_THRESHOLD,
    pole_tolerance: float = DEFAULT_NONZERO_TOLERANCE,
) -> Conjunction

The validity conditions of the second-order derivation on the superlattice.

Four domain conditions exclude the poles of the coupling map; six regime conditions are J << delta, J << U, |m| << U, Delta << delta, Delta << U and kappa << Delta.

Parameters:

Name Type Description Default
effective Namespace

the namespace of the effective theory, with m and kappa.

required
device Namespace

the namespace of the hardware model, with J, U, delta and Delta.

required
much_less_threshold float

the threshold theta at which a condition a << b is evaluated as a/b <= theta.

DEFAULT_MUCH_LESS_THAN_THRESHOLD
pole_tolerance float

the relative distance from a pole below which a domain condition fails.

DEFAULT_NONZERO_TOLERANCE

Returns:

Type Description
Conjunction

The conjunction.

second_order_perturbation_theory

second_order_perturbation_theory(
    source: Namespace,
    target: Namespace,
    *,
    admissible_set: AdmissibleSet | None = None,
    validity: Conjunction | None = None,
    target_name: str = "H_BHM",
    name: str = "second-order degenerate perturbation theory, inverted",
) -> SecondOrderPerturbationTheory

Build the perturbative transformation between an effective theory and a superlattice.

The relation carries the two equations of the forward direction, both solved forms of the mass equation, and the positive branch of the coupling equation solved for J.

Parameters:

Name Type Description Default
source Namespace

the namespace of the effective theory, with m and kappa.

required
target Namespace

the namespace of the hardware model, with J, U, delta and Delta.

required
admissible_set AdmissibleSet | None

the admissible knob set of the hardware; defaults to that of the hardware model.

None
validity Conjunction | None

a replacement for the default validity conditions.

None
target_name str

the name of the model produced.

'H_BHM'
name str

the name of the transformation.

'second-order degenerate perturbation theory, inverted'

Returns:

Type Description
SecondOrderPerturbationTheory

The transformation.

superexchange_transverse

superexchange_transverse(namespace: Namespace) -> Scalar

The transverse coupling Jxy = -4 t**2 / U_ud.

superexchange_longitudinal

superexchange_longitudinal(namespace: Namespace) -> Scalar

The longitudinal coupling Jz = 4 t**2 / U_ud - (4 t**2 / U_uu + 4 t**2 / U_dd).

superexchange_field

superexchange_field(namespace: Namespace) -> Scalar

The longitudinal field the derivation also produces, 2 t**2 (1/U_dd - 1/U_uu).

Per bond, second-order perturbation theory yields -(A - B)/2 (S^z_j + S^z_{j+1}) with A = 4t**2/U_uu and B = 4t**2/U_dd. Summed over the bonds, this is the field strength times sum_j z_j S^z_j of weighted_magnetisation_term, which is a constant within a magnetisation sector and a field on the two end spins. The field vanishes at U_uu = U_dd and is not part of the XXZ Hamiltonian of the target.

superexchange_validity

superexchange_validity(
    magnet: Namespace,
    device: Namespace,
    *,
    much_less_threshold: float = DEFAULT_MUCH_LESS_THAN_THRESHOLD,
    pole_tolerance: float = DEFAULT_NONZERO_TOLERANCE,
) -> Conjunction

The validity conditions of the superexchange derivation.

Three domain conditions, U != 0 per channel, and six regime conditions: t << |U| per channel, |Jxy| << |U_ud|, |Jz| << |U_uu| and |Jz| << |U_dd|.

Parameters:

Name Type Description Default
magnet Namespace

the namespace of the magnet, with Jxy and Jz.

required
device Namespace

the namespace of the hardware model, with t, U_uu, U_ud and U_dd.

required
much_less_threshold float

the threshold theta at which a condition a << b is evaluated as a/b <= theta.

DEFAULT_MUCH_LESS_THAN_THRESHOLD
pole_tolerance float

the relative distance from a pole below which a domain condition fails.

DEFAULT_NONZERO_TOLERANCE

Returns:

Type Description
Conjunction

The conjunction.

superexchange_reduction

superexchange_reduction(
    source: Namespace,
    target: Namespace,
    *,
    admissible_set: AdmissibleSet | None = None,
    validity: Conjunction | None = None,
    target_name: str = "H_2BHM",
    name: str = "second-order superexchange, inverted",
) -> SuperexchangeReduction

Build the superexchange transformation between a magnet and a two-component lattice.

The relation carries the two forward equations and their solved forms; with only (Jxy, Jz) known it is UNDER_DETERMINED by two.

Parameters:

Name Type Description Default
source Namespace

the namespace of the magnet, with Jxy and Jz.

required
target Namespace

the namespace of the hardware model, with t, U_uu, U_ud and U_dd.

required
admissible_set AdmissibleSet | None

the admissible knob set of the hardware; defaults to that of the hardware model.

None
validity Conjunction | None

a replacement for the default validity conditions.

None
target_name str

the name of the model produced.

'H_2BHM'
name str

the name of the transformation.

'second-order superexchange, inverted'

Returns:

Type Description
SuperexchangeReduction

The transformation.

dipole_detuning

dipole_detuning(namespace: Namespace) -> Scalar

The detuning Delta - U of the tilt from the dipole resonance Delta = U.

dipole_coupling

dipole_coupling(namespace: Namespace) -> Scalar

The Ising coupling Jz = U.

The constraint that forbids adjacent dipoles is a penalty of order U (Simon et al. 2011) and is taken equal to U. Both fields are divided by this penalty, so the dimensionless fields (hz, hx) do not depend on this choice.

dipole_transverse

dipole_transverse(namespace: Namespace) -> Scalar

The transverse field Gamma = 2 sqrt(2) J, of first order in the tunnelling.

dipole_longitudinal

dipole_longitudinal(
    magnet: Namespace, device: Namespace
) -> Scalar

The longitudinal field B = Jz - (Delta - U), that is hz = 1 - (Delta - U)/Jz.

dipole_boundary_field

dipole_boundary_field(namespace: Namespace) -> Scalar

The end-spin field Jz / 2 that the Ising Hamiltonian of the target omits.

The constraint is a sum over bonds, Jz sum_j (1/2 - S^z_j)(1/2 - S^z_{j+1}). Written as a coupling and the uniform field -Jz sum_j S^z_j, it lacks the term +(Jz/2) S^z on each end spin; see end_magnetisation_term.

dipole_validity

dipole_validity(
    magnet: Namespace,
    device: Namespace,
    *,
    much_less_threshold: float = DEFAULT_MUCH_LESS_THAN_THRESHOLD,
    pole_tolerance: float = DEFAULT_NONZERO_TOLERANCE,
) -> Conjunction

The validity conditions of the resonant-dipole derivation.

One domain condition, U != 0, and four regime conditions: J << U (a Mott insulator), |Delta - U| << Jz and Gamma << Jz (near the multicritical point) and delta << Gamma (the superlattice is a small staggered field on the spins).

Parameters:

Name Type Description Default
magnet Namespace

the namespace of the Ising chain, with Jz, Gamma and B.

required
device Namespace

the namespace of the hardware model, with J, U, delta and Delta.

required
much_less_threshold float

the threshold theta at which a condition a << b is evaluated as a/b <= theta.

DEFAULT_MUCH_LESS_THAN_THRESHOLD
pole_tolerance float

the relative distance from a pole below which a domain condition fails.

DEFAULT_NONZERO_TOLERANCE

Returns:

Type Description
Conjunction

The conjunction.

dipole_reduction

dipole_reduction(
    source: Namespace,
    target: Namespace,
    *,
    admissible_set: AdmissibleSet | None = None,
    validity: Conjunction | None = None,
    target_name: str = "H_BHM",
    name: str = "resonant dipole reduction, inverted",
) -> DipoleReduction

Build the dipole transformation between an Ising chain and a tilted optical lattice.

Parameters:

Name Type Description Default
source Namespace

the namespace of the magnet, with Jz, Gamma and B.

required
target Namespace

the namespace of the hardware model, with J, U, delta and Delta. Passing the namespace that another use case assigned to the hardware model makes the artifact shared.

required
admissible_set AdmissibleSet | None

the admissible knob set of the hardware; defaults to that of the hardware model.

None
validity Conjunction | None

a replacement for the default validity conditions.

None
target_name str

the name of the model produced.

'H_BHM'
name str

the name of the transformation.

'resonant dipole reduction, inverted'

Returns:

Type Description
DipoleReduction

The transformation.

trotterisation

Trotterisation: a Hamiltonian is mapped to an ordered product of k-local unitaries.

This is the only transformation that changes the artifact kind, from a Hamiltonian model to a product formula, and the only one whose approximation error is controlled by a resource parameter: the error decreases as the step count grows. The layer decomposition is derived from the supports of the terms (on-site terms, even-link terms, odd-link terms); whether the layers commute is computed as an exact Pauli sum and is not assumed.

SuzukiTrotter dataclass

Bases: NamespacedTransformation

A Suzuki-Trotter product formula over the layer decomposition of a Hamiltonian.

The resource settings are fields of the transformation; the choice of the step count for a requested accuracy is the discrete solve of qsimod.solving.stepcount. In the case study this is the step from H_IR4 to U_approx.

Attributes:

Name Type Description
time float

the simulated time t.

steps int

the step count n.

order int

the order of the product formula.

derive_partition bool

whether the greedy derived partition is used instead of the interleaved one.

target_structure
target_structure(source: StructureType) -> StructureType

The register is unchanged; only the artifact kind changes.

retimed
retimed(
    *,
    time: float | None = None,
    steps: int | None = None,
    order: int | None = None,
) -> SuzukiTrotter

A copy with different resource settings.

interleaved_layers_of

interleaved_layers_of(
    model: HamiltonianModel,
) -> LayerDecomposition

The (on-site, even links, odd links) partition of a bound interleaved qubit model.

Each layer is internally commuting: the on-site terms trivially, and the link layers because their terms have pairwise disjoint supports.

Parameters:

Name Type Description Default
model HamiltonianModel

a bound qubit Hamiltonian.

required

Returns:

Type Description
LayerDecomposition

The declared decomposition.

Raises:

Type Description
ValueError

if the model has free parameters.

derived_layers_of

derived_layers_of(
    model: HamiltonianModel,
) -> LayerDecomposition

The greedy first-fit partition of a bound model, derived from its Pauli terms.

Raises:

Type Description
ValueError

if the model has free parameters.

product_formula_from

product_formula_from(
    model: HamiltonianModel,
    *,
    time: float,
    steps: int,
    order: int,
    layers: LayerDecomposition | None = None,
    name: str = "U_Trotter",
    structure: StructureType | None = None,
) -> ProductFormulaModel

Build a product-formula artifact from a bound qubit Hamiltonian.

Parameters:

Name Type Description Default
model HamiltonianModel

the bound Hamiltonian.

required
time float

the simulated time t.

required
steps int

the step count n.

required
order int

the order of the product formula: 1, 2, or any even 2k >= 4.

required
layers LayerDecomposition | None

the layer decomposition; defaults to interleaved_layers_of.

None
name str

the name of the artifact.

'U_Trotter'
structure StructureType | None

the structural type of the target; defaults to that of the source.

None

Returns:

Type Description
ProductFormulaModel

The product formula, at the hardware layer.

suzuki_trotter

suzuki_trotter(
    source: Namespace,
    target: Namespace,
    *,
    time: float = 1.0,
    steps: int = 1,
    order: int = 2,
    derive_partition: bool = False,
    target_name: str = "U_Trotter",
    name: str = "",
) -> SuzukiTrotter

Build a Suzuki-Trotter transformation at the given resource settings.

Parameters:

Name Type Description Default
source Namespace

the namespace of the qubit Hamiltonian.

required
target Namespace

the namespace of the product formula.

required
time float

the simulated time.

1.0
steps int

the step count.

1
order int

the order of the product formula.

2
derive_partition bool

whether the greedy derived layer partition is used.

False
target_name str

the name of the artifact produced.

'U_Trotter'
name str

the name of the transformation; by default the name states the order.

''

Returns:

Type Description
SuzukiTrotter

The transformation.