Abstract circuit states

Define a class for abstract many-body representation of quantum circuits.

A ciruits is represented by a n-dimensional array of strings, where the first index labels the time-step, and the other indices label the position of the qubit in the lattice. Each string denote the name of the corresponding gate (see vulqano.gates.discretegates and vulqano.gates.discretegates).

class vulqano.states.abstractcircuitstate.AbstractCircuitState(vector, name, rot_amplitudes_array=None)[source]

Abstract representation of the state of the quantum circuit.

Arguments

vectornumpy.array of strings

Array of gates applied at each time and on each qubit. The first index correspond to the time step, the other indices label the qubit in the lattice.

namestr

Circuit name.

rot_amplitudes_arraynp array of float or None.

A numpy array of float with the same shape of the circuit, where at each entry a parameter is specified for the corresponding continuous gate. If none the state is a discrete state that can only contain discrete gates. Default is None.

Attributes

vectornumpy.array of strings

Array of gates applied at each time and on each qubit. The first index correspond to the time step, the other indices label the qubit in the lattice.

namestr

Circuit name.

timesint

Number of time steps of the circuit.

qubitstouple of ints

Number of qubits in each direction of the lattice.

is_continuousbool

If True the circuit contains continouous gates, False if it contains only discrete gates.

dimint

Number of dimension of the circuit state, i.e. 1 + number of dimensions of the qubits lattice.

rot_amplitudesnp array of float.

A numpy array of float with the same shape of the circuit, where at each entry a parameter is specified for the corresponding continuous gate. All entries are set to 0 for discrete gates set.

gates_dictionarydictionary

vulqano.gates.discretegates.GATES_DICTIONARY or vulqano.gates.continuousgates.GATES_DICTIONARY

add_swap_area(swap_l, swap_r)[source]

Adds layers of idle gates at the first and last time-steps of the circuit.

Arguments

swap_lint

Number of idle time steps at the beginning of the circuit.

swap_rint

Number of idle time steps at the end of the circuit.

Returns

selfAbstractCircuitState

Modified circuit.

draw(filename, ncols=1)[source]

Draw a figure representing the circuit as the state of a lattice.

Arguments

filenamestr

Name of the file, path and extension included.

ncolsint, optional

Number of columns in kegend. If 0, no legend is plotted.

Returns

None.

expand(distance, idle_block_length)[source]

Expand the circuit by adding unifomly distrubited blocks of idle time-steps at a fixed distance.

Arguments

distanceint

Distance between blocks of idle time-steps.

idle_block_lengthint

Number of time steps in the idle blocks.

Returns

selfAbstractCircuitState

Modified circuit.

get_energy(hamiltonian_operator)[source]

Returns the energy associated to the circuit state by an Hamiltonian operator.

Arguments

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] 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

energyfloat

Energy associated to the circuit state by the Hamiltonian operator.

make_3d()[source]

Extends the qubit lattice dimension a (1+1)d circuit via Hilbert mapping and returns an equivalent (1+2)d circuit.

Returns

AbstractCircuitState

(1+2)d circuit

to_qasm()[source]

Returns the OPENQASM code for the circuit.

Returns

openqasm_stringstr

OPENQASM code for the circuit.