Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qedma fails on simple bound circuit #29

Open
nonhermitian opened this issue Nov 4, 2024 · 2 comments
Open

Qedma fails on simple bound circuit #29

nonhermitian opened this issue Nov 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@nonhermitian
Copy link

Steps to reproduce the problem

Consider the circuit operator pair (also used in #22)

op = SparsePauliOp('ZIIIII')

g = Parameter('g')
g_vals = np.linspace(0, np.pi, 11)

qc = QuantumCircuit(6)
qc.h(0)
qc.cx(0, 5)
qc.h(1)
qc.cx(1, 4)
qc.h(2)
qc.cx(2, 3)
qc.rx(-np.pi/2, 0)
qc.rx(-np.pi/2, 1)
qc.rx(-np.pi/2, 2)
qc.rz(-0.0566794, 0)
qc.rz(-0.01039906, 1)
qc.rz(-0.0632158, 2)
qc.rzz(-np.pi/2, 0, 1)
qc.rzz(-np.pi/2, 1, 2)
qc.rx(-np.pi/2, 0)
qc.rx(-np.pi/2, 1)
qc.rx(-np.pi/2, 2)
qc.rz(-0.0566794, 0)
qc.rz(-0.01039906, 1)
qc.rz(-0.0632158, 2)
qc.rzz(-np.pi/2, 0, 1)
qc.rzz(-np.pi/2, 1, 2)
qc.rx(-np.pi/2, 0)
qc.rx(-np.pi/2, 1)
qc.rx(-np.pi/2, 2)
qc.rz(-0.0566794, 0)
qc.rz(-0.01039906, 1)
qc.rz(-0.0632158, 2)
qc.rzz(-np.pi/2, 0, 1)
qc.rzz(-np.pi/2, 1, 2)
qc.reset(0)
qc.rz(0.0566794, 0)
qc.rz(0.01039906, 1)
qc.rz(0.0632158, 2)
qc.rzz(np.pi/2, 0, 1)
qc.rzz(np.pi/2, 1, 2)
qc.rx(np.pi/2, 0)
qc.rx(np.pi/2, 1)
qc.rx(np.pi/2, 2)
qc.rz(0.0566794, 0)
qc.rz(0.01039906, 1)
qc.rz(0.0632158, 2)
qc.rzz(np.pi/2, 0, 1)
qc.rzz(np.pi/2, 1, 2)
qc.rx(np.pi/2, 0)
qc.rx(np.pi/2, 1)
qc.rx(np.pi/2, 2)
qc.rz(0.0566794, 0)
qc.rz(0.01039906, 1)
qc.rz(0.0632158, 2)
qc.rzz(np.pi/2, 0, 1)
qc.rzz(np.pi/2, 1, 2)
qc.rx(np.pi/2, 0)
qc.rx(np.pi/2, 1)
qc.rx(np.pi/2, 2)
# Here are the two RZZ gates that are parameterized
qc.rzz(g, 1, 4)
qc.rzz(g, 2, 3)
# -------------------------------------------------
qc.rx(np.pi/2, 5)
qc.rx(np.pi/2, 4)
qc.rx(np.pi/2, 3)
qc.rz(0.0566794, 5)
qc.rz(0.01039906, 4)
qc.rz(0.0632158, 3)
qc.rzz(np.pi/2, 5, 4)
qc.rzz(np.pi/2, 4, 3)
qc.rx(np.pi/2, 5)
qc.rx(np.pi/2, 4)
qc.rx(np.pi/2, 3)
qc.rz(0.0566794, 5)
qc.rz(0.01039906, 4)
qc.rz(0.0632158, 3)
qc.rzz(np.pi/2, 5, 4)
qc.rzz(np.pi/2, 4, 3)
qc.rx(np.pi/2, 5)
qc.rx(np.pi/2, 4)
qc.rx(np.pi/2, 3)
qc.rz(0.0566794, 5)
qc.rz(0.01039906, 4)
qc.rz(0.0632158, 3)
qc.rzz(np.pi/2, 5, 4)
qc.rzz(np.pi/2, 4, 3)

Since it is unclear if Qedma takes parameters, and seems to only work with a single circuit, I bound a single circuit instance using

bound_qc = qc.assign_parameters({'g':g_vals[5]}, inplace=False)
pubs = [(bound_qc, [op])]

running this using

qesem_function  = catalog.load('qedma/qesem')
qesem_job = qesem_function.run(
    backend_name=backend.name,
    action = "execute",
    instance = backend._instance,
    pubs = pubs,
)

fails, even though the circuit and operator work (without the operator in a list) in the IBM circuit function

What is the current behavior?

I currently get {'error': 'Got wrong gate parameters.'}

What is the expected behavior?

It should work

@nonhermitian nonhermitian added the bug Something isn't working label Nov 4, 2024
@assafb
Copy link

assafb commented Nov 6, 2024

The error is because of the reset instruction, not because of the bound. We do support bounded circuits

@pandasa123
Copy link
Collaborator

pandasa123 commented Nov 6, 2024

The error is because of the reset instruction, not because of the bound

@assafb, does QESEM not support reset? If so, I think we should call this out in the documentation + error message, since it's an instruction that Qiskit has supported for the past 5+ years and users will be a bit confused otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants