Inability to construct noisy version of a parametric gate
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 358
- Avg merge
- 1d 58m
- Merged PRs (30d)
- 4
Description
Usually I can over-ride some standard gate (e.g. X) with some Kraus operators using define_noisy_gate. The same doesn't seem to work with parametric gates such as RY. If I try to run the following:
from pyquil import get_qc, Program
from pyquil.gates import RY, MEASURE
import numpy as np
# bit flip kraus ops
prob = 0.1
kraus_ops = [np.sqrt(1 - prob) * np.array([[1, 0], [0, 1]]),
np.sqrt(prob) * np.array([[0, 1], [1, 0]])]
p = Program(RY(np.pi/2, 0))
p.define_noisy_gate('RY', [0], kraus_ops)
ro = p.declare('ro', 'BIT', 1)
p += MEASURE(0, ro[0])
p.wrap_in_numshots_loop(1000)
qc = get_qc('1q-qvm')
results = qc.run(p)
I get the following error msg
QVMError: The value of QVM::GATE is #<CL-QUIL:PARAMETERIZED-GATE {100354A5C3}>, which is not of type CL-QUIL:STATIC-GATE.
The QVM returned the above error. This could be due to a bug in the server or a
bug in your code. If you suspect this to be a bug in pyQuil or Rigetti Forest,
then please describe the problem in a GitHub issue at:
https://github.com/rigetti/pyquil/issues
Is there any way to construct a noisy version of a parametric gate?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Program.define_noisy_gate, RY, and the 1q-qvm example in the issue. Trace how the parameterized RY instruction reaches the QVM and determine whether noisy construction is supported; done means the behavior is fixed or the supported limitation is clearly established and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- quantum-computing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100