-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implement poisson function #209
Implement poisson function #209
Conversation
There are two different ways that poisson random numbers are generated in CUDA now:
To decide which RNG type to use, I regex match the lamba_vectorized = True
try:
# try to convert to float, will raise ValueError if not possible
lamda_value = float(lamda_str)
lamba_vectorized = False
except ValueError:
# lamda is not a literal but a variable, check if lamda is scalar
lamda_var = codeobj.variables[lamda_str]
if lamda_var.scalar and lamda_var.constant:
lamda_vectorized = False
lamda_value = lamda_var.value @mstimberg If the check is fine, it will still miss a few cases where host side RNG could be used: E.g. if |
dc0ba76
to
15472ce
Compare
6c74703
to
6792994
Compare
15472ce
to
06f1d94
Compare
5279419
to
e2e3365
Compare
06f1d94
to
9b8af3c
Compare
RNG by precalculating needed number of random numbers is implemented but returning the correct random numbers when calling `poisson` is not implemented yet
Not tested. Missing: different lambda across codeobject
This commit mostly cleans up the random number generation. That means, changing variable names, restructuring variable types etc. and adding code documentation.
There was a bug due to functions being used before definition or declaration
e2e3365
to
4de8c92
Compare
I added Tests are passing. I opened #228 to make sure the logic for checking poisson's lambda variable are correct. Merging. |
This PR implements the
poisson
function. Should close #174.See brian-team/brian2#1111