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

Fix to complex numbers in cxSimulatedBinaryBounded #567

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markstrefford
Copy link

In certain situations, beta_q is creating a complex number (see https://stackoverflow.com/questions/66903214/why-is-python-creating-a-complex-number-here/66903343). This is because the unary - in a negative result for (1.0 / (2.0 - rand * alpha)) takes precedence over ** (1.0 / (eta + 1)).

This fix identifies the sign (-/+) and uses the absolute values in the calculation for beta_q, then retrospectively applies the correct sign again.

@fmder
Copy link
Member

fmder commented Nov 13, 2021

Not sure it is really operator precedence as the expression is wrapped in parenthesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants