qrisp.jasp.Jaspr.to_qc#

Jaspr.to_qc(*args)[source]#

Converts the Jaspr into a QuantumCircuit if applicable. Circuit conversion of algorithms involving realtime computations is not possible.

Parameters:
*argstuple

The arguments to call the Jaspr with.

Returns:
QuantumCircuit

The resulting QuantumCircuit.

return_valuestuple

The return values of the Jaspr. QuantumVariable return types are returned as lists of Qubits.

Examples

We create a simple script and inspect the QuantumCircuit:

from qrisp import *
from qrisp.jasp import make_jaspr

def example_function(i):

    qv = QuantumVariable(i)
    cx(qv[0], qv[1])
    t(qv[1])
    return qv

jaspr = make_jaspr(example_function)(2)

qc, qb_list = jaspr.to_qc(2)
print(qc)
# Yields
# qb_0: ──■───────
#       ┌─┴─┐┌───┐
# qb_1: ┤ X ├┤ T ├
#       └───┘└───┘