measure() and if_test() reject NumPy integers
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in python/qsengine/__init__.py and inspect the integer checks in measure() and if_test(); compare them with the gate methods that already accept NumPy integers. Run the relevant tests, then add coverage for NumPy integer inputs and non-integer sequences. Done when both methods accept integer-like values and still handle sequences correctly.
Written by the indexing model from the issue text.
Description
Code that shows the problem
q = np.arange(3)[0] # numpy.int64
qc.measure(q, 0) # TypeError: 'numpy.int64' object is not iterable
with qc.if_test(np.int64(1), 1): ... # same error
What you expected, and what happened instead
Gate methods accept NumPy integers, but these two don't, because they check
isinstance(x, int), which is False for numpy.int64 (python/qsengine/__init__.py).
Use operator.index(x) (or check for numbers.Integral) to accept anything integer-like, and
treat everything else as a sequence.
qsengine version
1.1.0
Operating system, Python version and GPU
Windows 10, Python 3.14.7
Backend
None
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- Avg merge
- 12m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from kaiwave/qsengine
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in kaiwave/qsengine
Similar issues
-
bug order-flow studies ui
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
userFRM/egui-charts#2417 ·
Maintainers usually reply within 1 day
-
In a plain-text message, Font, Font Size, Font Color and Text Highlight Color stay livePossibly taken @ragelfundionctrumnar claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
UCS-Care-Group/mailcraft#862 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
smoltcp-rs/smoltcp#1243 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day