Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qiskit_qec.linear.symplectic.def _symplectic_product_vv_boolean gives wrong results #431

Closed
kaiott opened this issue Apr 26, 2024 · 2 comments · Fixed by #437
Closed

qiskit_qec.linear.symplectic.def _symplectic_product_vv_boolean gives wrong results #431

kaiott opened this issue Apr 26, 2024 · 2 comments · Fixed by #437
Labels
bug Something isn't working

Comments

@kaiott
Copy link
Contributor

kaiott commented Apr 26, 2024

Steps to reproduce the problem

import numpy as np
from qiskit_qec.linear.symplectic import _symplectic_product_vv_boolean

a = np.array([1,0,0,0,1,1,1,0,1,0], dtype=np.bool_)
b = np.array([1,1,1,1,0,0,1,0,1,1], dtype=np.bool_)
_symplectic_product_vv_boolean(a, b, 5)

What is the current behavior?

Returns 1

What is the expected behavior?

The function should return 0, which is the actual symplectic product of the two vectors.
This example is actually the example in the docstring.

Note: Within qiskit_qec this function is never used, as in symplectic_product the input arrays are always converted to dtype numpy.int8.

@kaiott kaiott added the bug Something isn't working label Apr 26, 2024
@drewvandeth
Copy link
Collaborator

drewvandeth commented Aug 26, 2024

Thanks @kaiott This is definitely wrong and has a rather simple fix:

r += vec1[i] & vec2[n + i] ^ vec1[n + i] & vec2[i]

should be

r ^= vec1[i] & vec2[n + i] ^ vec1[n + i] & vec2[i]

@drewvandeth
Copy link
Collaborator

I will include this fix in a PR that I am pushing through now.
PR #437

drewvandeth added a commit that referenced this issue Aug 26, 2024
drewvandeth added a commit that referenced this issue Aug 26, 2024
* Updated location of QuantumErrorChannel in aer

* linting and Updates for qc.data accesses

* Updated requirements-dev.txt wrt black

* linter change

* Fix for issue #431

* Linting

* Adjusting one int type to long int + corrected doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants