`pyquil.paulis.PauliSum.__mul__` doesn't work with `numpy.float64`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 358
- Avg merge
- 1d 58m
- Merged PRs (30d)
- 4
Description
When multiplying a PauliSum with a numpy.float64 it returns a list of terms instead of the PauliTerm.
>>> from pyquil.paulis import PauliTerm
>>> import numpy as np
>>> ham = PauliSum([PauliTerm("I",0), PauliTerm("Z",0)])
>>> print(0.5*ham)
(0.5+0j)*I + (0.5+0j)*Z0
>>> print(np.float64(0.5)*ham)
[<pyquil.paulis.PauliTerm object at 0x7fa33497ce48>
<pyquil.paulis.PauliTerm object at 0x7fa33497c208>]
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 at pyquil.paulis.PauliSum.mul and reproduce the difference between Python float and numpy.float64 scalar multiplication shown in the issue. Done means numpy.float64 multiplication returns the expected PauliSum or PauliTerm result rather than a list of PauliTerm objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- quantum-computing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100