Collapsed quantum model

Here we define functions to map the compilation problem into a quantum many-body system to simulate with qtealeaves.

In the collapsed mapping, we map the circuit in a q-dimensional qudits lattice. The coordinate labels the time-step, and the state of each qudit represents a possible time-step.

class vulqano.quantummodels.collapsedquantummodel.CollapseMap(gates, circuit_times, n_t, n_q, reflection_sym=False)[source]

Maps the circuit states and operators from a (1+1)d lattice to a 1d lattice by collasing the qubit axis. Each possible gates configuration of a time step is mapped to a single local state.

Arguments

gatesset of str

Gates allowed on the target machine (fictitious gates such as “idle “and “busy” are excluded).

circuit_timesint

number of time steps allowed for the cicuit.

n_tint

number of time steps represented in the lattice.

n_qint

Number of qubits of the target machine.

reflection_symbool, optional.

If true, only the supergates that represent time-steps invariant under a reflection on the qubits axis are included. Default is false. WARNING: needs reflection invariant infidelity and transition rules.

Attributes

gatesset of str

Gates allowed on the target machine (fictitious gates such as “idle “and “busy” are excluded).

circuit_timesint

number of time steps allowed for the cicuit.

n_tint

number of time steps represented in the lattice.

n_qint

Number of qubits of the target machine.

collapsed_gateslist

A list of each possible time-step configuration, identified by a string “gate_0|gate_1|…|gate_n_q”.

reflection_symbool

If true, only the supergates that represent time-steps invariant under a reflection on the qubits axis are included.

build_driving_hamiltonian(rule, model, strength)[source]

Build a term in the driving Hamiltonian encoding a transition rule, add this Hamiltonian to the model.

Arguments

rule: instance of DiscreteTransformationRule

Transition rule to be encoded as operator.

modelqtealeaves.modeling.QuantumModel

QuantumModel describing the evolution Hamiltonian.

strengthstring

Name of the coupling associated to the Hamiltonian term.

Returns

None.

build_external_hamiltonian(model)[source]

Build an Hamiltonian that sets as idle all the lattice sites that are external to the ciruit area.

Arguments

modelqtealeaves.modeling.QuantumModel

QuantumModel describing the evolution Hamiltonian.

Returns

None.

build_infidelity_hamiltonian(hamiltonian, model, strength)[source]

Build an Hamiltonian that extimated the circuit infidelity, add this Hamiltonian to the model

Arguments

modelqtealeaves.modeling.QuantumModel

QuantumModel describing the evolution Hamiltonian.

strengthstring

Name of the coupling associated to the Hamiltonian.

Returns

None.

build_initial_hamiltonian(state, model, strength, position=0)[source]

Build an Hamiltonian having the initial state as non-degenerate ground state, add this Hamiltonian to the model

Arguments

modelqtealeaves.modeling.QuantumModel

QuantumModel describing the evolution Hamiltonian.

strengthstring

Name of the coupling associated to the Hamiltonian.

Returns

None.

collapse_hamiltonian_term(operator, prefactor, mask)[source]

Generate a collapsed version of an Hamiltonian term.

Parameters

operatornp.array of strings

Block of local operators, expressed as tensor product of the local operators.

prefactorfloat

Coupling of the term in the Hamiltonian

maskmask

The operator is applied on a region A if the mask is true in each site of the region.

collapse_rule(rule)[source]

Generates a collapsed version of a transition rule.

Arguments

ruleinstance of DiscreteTransformationRule

Transition rule to be encoded in a set of collapsed rules.

Yields

List of collapsed rules encoding the applicat of the original rule to different slices of qubits.

collapsed_state_alist of strings or None

Collapsed decsription of the state_a of the rule, encoded as a list of supergates names. If the reflection symmetry is enabled, returns None for non symmetric states.

collapsed_state_blist of strings or None

Collapsed decsription of the state_b of the rule, encoded as a list of supergates names. If the reflection symmetry is enabled, returns None for non symmetric states.

collapse_substate(state, position=0)[source]

Collapse a circuit or a subcircuit.

Arguments

statematrix of strings

Description of the local (sub) circuit to be collapsed. If the number of qubits of the subcircuit is smaller than the number of qubits of the circuit, the remaining qubits are filled with “any” (identity operator) gates.

positionint, optional

Qubit position of the subcircuit. The default is 0.

Returns

collapsed_statelist of strings

Collapsed decsription of the state, encoded as a list of supergates names.

decollapse_state(collapsed_state)[source]

Transform a collapsed a circuit to a non-collapsed circuit.

Arguments

collapsed_statelist of strings

Collapsed decsription of the state, encoded as a list of supergates names.

Returns

statematrix of strings

Description of the circuit state in terms of gates at each qubit and time-step.

vulqano.quantummodels.collapsedquantummodel.get_collapsed_quantum_compilation_model(input_circuit, machine, qcd_instructions, shape, collapse_map)[source]

Maps the compilation problem into a quantum many-body system to simulate with qtealeaves. In this collapsed mapping, each qudit encodes a time step of the circuit.

Arguments

input_circuitinstance of AbstractCircuitState

Classical circuit state, the initial state of the dynamics.

machinedictionary
hamiltonian_operatorlist of (np.array of strings, float, mask)

Abstract description of the Hamiltonian. The energy is obtained by counting how many times each subcircuit hamiltonian_operator[i][0] appears on a region A of the circuit suck that that hamiltonian_operator[i][2] is True for all (t,q) in A. The counted number is multiplied by the weight hamiltonian_operator[i][1].

gatesset

Gates enabled on the machine (virtual gates included).

qcd_instructionsdictionary
annealing_Tfloat

Annealing time.

rules_classesstr or list of ints, optional

A list of the ints identifying the rule classes that we want to generate. Default is “all” and generates all the rule classes.

generators“std” or list of generators, optional

The list of generators producing the rules to be used. Default is “std”, in this case a standard list of rules is used.

annealing_schedulechar, optional

Pulse schedule for the annealing process. Default is A.

max_rules_volumeint, optional

Maximum volume allowed for the rules to be included in the driving Hamiltonian. Default is 100.

shapetuple of ints

Shape of the lattice where the circuit is encoded, including fictitious sites added to fit in a TTN.

collapse_mapinstance of CollapseMap

Describes how each possible time step is associated to a qudit state.

Returns

shapetuple of ints

Shape of the lattice where the circuit is encoded, including fictitious sites added to fit in a TTN.

my_opsinstance of qtealeaves.operators.TNOperators

Operators that transform a gate state into another gate state.

my_obsinstance of qtealeaves.observables.TNObservables

Defines the observables of the simulation. For details, check the corresponding class.

modelinstance of qtealeaves.modeling.QuantumModel

System Hamiltonian in the form

H = H_ext + alpha*H_initial + beta*H_driving + gamma*H_final

where:

-H_ext = sum_i |idle><idle|

is a 1-local Hamiltonian acting on the sites of the lattice that does not correspond to a circuit site.

-H_initial

is 1-local Hamiltonian having the initial circuit as ground state.

-H_driving

is the Hamiltonian that drives the evolution by creating superpositions of equivalent circuit.

-H_final

is the Hamiltonian that encodes the infidelity function.

vulqano.quantummodels.collapsedquantummodel.reverse_time_step(state)[source]

Reverse the order of the qubits in a time step.

Arguments

statelist of strings

List of gate names that describe the time step.

Returns

reverselist of strings

List of gate names that describe the reversed time step.