observe() generates more kernels than necessary
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
cudaq.observe seems to generate more kernels/programs than necessary. E.g. one of the internal test cases
hamiltonian = (5.907 - 2.1433 * spin.x(0) * spin.x(1) -
2.1433 * spin.y(0) * spin.y(1) + 0.21829 * spin.z(0) -
6.125 * spin.z(1))
generates 4 kernels that are executed separatly, but 3 should be sufficient, since z(0) and z(1) can be sampled in the same shot.
Is this a feature that I simply have to enable, or is this just not implemented yet?
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
Start with the cudaq.observe entry point and the internal test case described in the issue. Trace how Hamiltonian terms become executed kernels, focusing on whether z(0) and z(1) can share a shot. Done means the example uses three executions instead of four, with coverage in the relevant internal test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- quantum-computing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100