You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
Make sure you've read the documentation. Your issue may be addressed there.
Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
I want to use the controlled version of exp_pauli to apply the Hamiltonian simulation of the coefficient matrix of a linear system of equations as a part of a HHL-type algorithm.
Throughout the circuit, I call the controlled exp_pauli in a for loop to apply the Hamiltonian controlled by different cubits.
The error I get is as follows:
error: 'quake.extract_ref' op invalid constant index value
RuntimeError Traceback (most recent call last)
Cell In[17], line 3
1 # Draw the quantum circuit
2 print("============================== Circuit structure ============================== \n")
----> 3 print(cudaq.draw(GQLSS, b, eigs, r_choice, 2*np.pi, coefficients, words))
RuntimeError: cudaq::builder failed to JIT compile the Quake representation.
Thanks for reporting this issue, @psm-optimizes. Based on a quick look, it looks like there is bug in how CUDA-Q is handling this section of code:
# Apply y rotations on Ancilla qubitforiinrange(len(qReg)+1):
ifi!=0:
ry.ctrl((2*np.pi)/eigs[i-1], [qReg[i-1]], qAnc)
While we investigate the underlying issue a bit further, I figured it would be worth sharing that there is a workaround available. If you change your code to this, then I think it will work.
# Apply y rotations on Ancilla qubitforiinrange(1, len(qReg)+1):
ry.ctrl((2*np.pi)/eigs[i-1], [qReg[i-1]], qAnc)
After resolving this issue, the next error message that comes up is RuntimeError: Applying controlled global phase via exp_pauli of identity operator is not supported. That message is occurring because CUDA-Q does not support calling exp_pauli on terms with all Is, so I believe you will need to make this change:
# Drop the `II` term. Adjust downstream calculations as needed.words=words[1:]
coefficients=coefficients[1:]
Required prerequisites
Describe the bug
error: 'quake.extract_ref' op invalid constant index value
RuntimeError Traceback (most recent call last)
Cell In[17], line 3
1 # Draw the quantum circuit
2 print("============================== Circuit structure ============================== \n")
----> 3 print(cudaq.draw(GQLSS, b, eigs, r_choice, 2*np.pi, coefficients, words))
RuntimeError: cudaq::builder failed to JIT compile the Quake representation.
Steps to reproduce the bug
The code is available here.
Expected behavior
The circuit should be drawn.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
Suggestions
No response
The text was updated successfully, but these errors were encountered: