We use cookies to try and give you a better experience in Freshdesk.
You can learn more about what kind of cookies we use, why, and how from our Privacy policy. If you hate cookies, or are just on a diet, you can disable them altogether too. Just note that the Freshdesk service is pretty big on some cookies (we love the choco-chip ones), and some portions of Freshdesk may not work properly if you disable cookies.
We’ll also assume you agree to the way we use cookies and are ok with it as described in our Privacy policy, unless you choose to disable them altogether through your browser.
Here is some sample code in classiq in which I intialized circuit with some specific state and applying some specific gates:
probabilities = (0.25, 0.25, 0, 0, 0.25, 0, 0, 0.25)
from classiq.builtin_functions import StatePreparation
State = StatePreparation(probabilities=probabilities, error_metric={"KL": {"upper_bound": 0.3}})
from classiq.builtin_functions import RZGate,StatePreparation,CXGate,XGate, IGate
from classiq import Model
model = Model()
Initialized_state = model.StatePreparation(State)
pre_check = model.XGate(XGate(), in_wires={"TARGET":Initialized_state["OUT"][1]})
check = model.CXGate(CXGate(), in_wires={"TARGET":pre_check["TARGET"],"CTRL":Initialized_state["OUT"][0]})
post_check1 = model.XGate(XGate(), in_wires={"TARGET":check["CTRL"]})
I_check = model.IGate(IGate(), in_wires={"TARGET":post_check1["TARGET"]})
from classiq import synthesize , show
qprog = synthesize(model.get_model())
show(qprog)
As one can easily see to use the same qubit again we have to name it with some variable so that we can use this qubit further in the next step otherwise if we didn't give the name Classiq framework through error that you can't used consumable qubit again. But this practice become very cumbersome if we have to use conditional statements to apply. Can we do the the programming of circuit without using this practice like as we can do in QISKIT where we have to just name the qubit like X.qc[1] and it apply X gate on qubit one. Can we do the same in Classiq and How? Any help is appreciated. Thank you
0 Votes
0 Comments
Login or Sign up to post a comment