unitaria.Circuit

class unitaria.Circuit(tq_circuit: QCircuit | None = None)[source]

Bases: object

Representation of a quantum circuit.

This is just a wrapper around the Tequila QCircuit class.

Parameters:

tq_circuit – The representation of the circuit for the tequila backend.

add_controls(controls)[source]
adjoint() Circuit[source]

Gives the inverse circuit (corresponding to the adjoint unitary).

depth() int[source]
draw() str[source]

Draw this circuit and return a string representation.

If qpic is installed, this will generate a temporary file containing a pdf of the circuit and return a file:// url to the pdf, which should be printed to the user.

map_qubits(map)[source]
simulate(input: ndarray | int = 0, **kwargs) ndarray[source]

Simulate this circuit. For additional arguments see simulate().

Parameters:

input – The initial state from which the circuit should be simulated. If input is a vector, it will be interpreted as amplitudes of the computational basis states and its dimension should be 2 ** n_qubits. If it is an integer i, it will be interpreted as the i-th computational basis state.

n_qubits: int = 0