-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
"math domain error" in mapping #111
Comments
This is due to numerical error in the argument of acos in yzy_to_zyz. For example, math.sin(math.pi/2) * math.cos(math.pi/4) / math.sin(math.pi/4) = 1.0000000000000002 > 1. One solution is to round the argument. |
One option is to round, but that might add errors after several computations. I suggest to move to symbolic computation instead of flouting point math to avoid this issue:
Comments? |
I think @awcross1 was giving an example where it fails, but it general the inputs are not symbolic they are floats. |
The particular case in I'm not sure what you mean. In situations where user code has floats, that error is introduced by the user and we can represent exactly that error without adding more, using Decimal in the parser. My point is, when possible, we should operate with symbols to avoid adding error. |
Thanks Luciano, I think it is worth investigating using symbols. |
Here is a self-contained test case from @dcmckayibm that triggers the error from qiskit import QuantumProgram coupling_map_test = {0:[0]} |
Closing the issue, as it was fixed by #151 - thanks Luciano! |
Current Behavior
The attached fuzz_reccztqq.txt triggers a
ValueError: math domain error
exception when executed with the mapping{0: [2], 1: [2], 2: [3], 3: []}
:Expected Behavior
It is my understanding that the program should execute just like as when there is no map restriction:
The attached example was generated by a fuzzer. It could be the current behavior is the expected. My apologies in that case...
The text was updated successfully, but these errors were encountered: