Quantum dynamics

Here we define the function that performs optimization based on quantum dynamics of a state that encodes a superposition of circuits (e.g. quantum annealing).

The dynamics is simulated using qtealeaves.

class vulqano.quantumdynamics.CircuitsFromTN(filename, gates, shape, real_shape, collapse_map, num_samples=1000, max_data_size=1000, min_prob=0.0001)[source]

Class to read a distribution of quantum circuit from a TN state of qtealeaves.

Arguments

filenamestr

Name of the source file where the TTN is stored.

gateslist of strings sorted alphabetically

If the circuit is not collapsed, list of gates involved in the circuit, with idle and busy excluded. If the circuit is collapsed, list of supergates representing the possible local states.

shapetuple of ints

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

real_shapetuple of ints

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

collapse_mapNone or quantummodels.collapsedquantummodel.CollapseMap

None if the circuit is not collapsed, else CollapseMap object encoding the supergate to time-step translation.

max_data_siteint, optional

Maximum number of distribution elements to be stored. Default is 1000.

min_probint, optional

Minimal probability for a sampled circuit to be stored. Default is 0.0001.

Attributes

circuits_and_probabilitieslist of (AbstractCircuitState, float)

Sampled circuits with the associated probabilities.

sampled_probabilityfloat

Total probability sampled. If the stored sampling is complete, this value is 1.

get_classical_energy_statistics(hamiltonian)[source]

Returns the statistics associated to a classical observable (energy), in terms of values vs probabilities.

Parameters

hamiltonianlist 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] is applied on a site of the circuit state such that hamiltonian_operator[i][2](t,q) is True. The counted number is multiplied by the weight hamiltonian_operator[i][1].

Returns

energy_vs_probabilitydictionary

A dictionary that associates to each energy a probability of being measured.

get_equivalence_ratio_and_best_state(input_circuit, hamiltonian, max_iter=100)[source]

Generates the probability of sampling a circuit that is equivalent to the input circuit, and the sapled equivalent circuit qith minimum energy.

Parameters

input_circuitAbstractCircuitState

Input circuit that must be equivalent to the sampled circuits.

hamiltonianlist 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] is applied on a site of the circuit state such that hamiltonian_operator[i][2](t,q) is True. The counted number is multiplied by the weight hamiltonian_operator[i][1].

max_iterint, optional

Max number of circuit for which the equivalence has to be checked. The default is 100.

Returns

equivalent_probabilityfloat

Sampled probability of getting an equivalent circuit.

not_equivalent_probabilityfloat

Sampled probability of getting a non equivalent circuit.

best_stateAbstractCircuitState

Equivalent sampled circuit that minimizes the energy. The associated probability and energy are encoded in best_state.name .

vulqano.quantumdynamics.quantum_circuit_dynamics(input_circuit, machine, qcd_instructions, simulation_instructions, max_results_size=100, del_data=False)[source]

Evolve a state representing a quantum circuit qith a quantum dynamics. The dynamics is simualted with QuantumTEA.

Arguments

input_circuitAbstractCircuitState

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.

simulation_instructionsdictionary
simulation_namestr

Name identifiung the folder of simulation input and output.

delta_tfloat

Time step duration for the simualtion.

max_bond_dimensionint

Max bond dimension for TN simulation.

svd_modechar, optional

Singular value decomposition mode. Default is “V”. See Quantum Tea Leaves for more informations.

time_evolution_modeint, optional

Time evolution mode. Default is 5. See Quantum Tea Leaves for more informations.

mpo_modeint, optional

Matrix product operators mode. Default is 4. See Quantum Tea Leaves for more informations.

gs_search_iterint, optional

Number of iterations for the initial GS search. Default is 3.

collapsedbool, optional

If true, each possible configuration of qubit lattice is represented by the state of a single qudit. Default is False.

reflection_symbool, optional

If true, enable reflection symmetry on the qubit axis. Default is False.

max_results_sizeint, optional

Max size of the observable evolution in output. Default is 100.

del_data ; bool, optional

If true, simulation data are deleted at the end of the simulation. Default is false.

Returns

output_dictionarydictionary
qcd_parametersdictionary
software_versionstr

Version of the software used for the simulation.

initial_stateCircuitState

See Parameters

machinedictionary

See Parameters

qcd_instructionsdictionary

See Parameters

simulation_instructionsdictionary

See Parameters

qcd_resultsdictionary
computational_timefloat

total computational time of the simulated annealing.

initial_energyfloat

Initial energy

best_stateAbstractCircuitState

Describes the lowest infidelity equivalent state at the end of the simulation.

final_equivalence_ratiofloat, float

Salpled probability of a final circuit equivalent to the initial one, sampled probability of a final circuit not equivalent to the initial one.

energy_evolutionnumpy.array

A matrix that associate to each time the expectation value of the energy at that time.

inf_energy_evolutionlist of (float, dictionary)

A list of tuples, the first element of each tuple is the time, the second element is a dictionary that associates to each possible enrgy a probability.

norm_evolutionlist of (float, float)

A matrix that associate to each time the total sampled probability of the state at that time.