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

Consider adding BigFloat support for randn/randexp #17629

Closed
NHDaly opened this issue Jul 26, 2016 · 10 comments · Fixed by #44714 · May be fixed by #35111
Closed

Consider adding BigFloat support for randn/randexp #17629

NHDaly opened this issue Jul 26, 2016 · 10 comments · Fixed by #44714 · May be fixed by #35111
Labels
bignums BigInt and BigFloat good first issue Indicates a good issue for first-time contributors to Julia help wanted Indicates that a maintainer wants help on an issue or pull request randomness Random number generation and the Random stdlib

Comments

@NHDaly
Copy link
Member

NHDaly commented Jul 26, 2016

#17627 adds MethodError domain checks that you cannot call randn or randexp for any types besides the currently supported Float16,Float32,Float64.

Do we also want to extend support to BigFloat? I don't know much about, but I've left TODO code comments in #17627 (comment) asking to consider this question.

This is a tracking issue for that discussion.

@tkelman tkelman added the randomness Random number generation and the Random stdlib label Jul 26, 2016
@tkelman
Copy link
Contributor

tkelman commented Jul 26, 2016

x-ref #13950

@ViralBShah
Copy link
Member

I wonder what bits of the Marsaglia and Tsang paper need to be reworked to do this right.

@dpsanders
Copy link
Contributor

cf http://randomlib.sourceforge.net/html/index.html, which has an MIT/X11 license.

@dpsanders
Copy link
Contributor

@rfourquet rfourquet added the bignums BigInt and BigFloat label Jul 9, 2017
@Keno
Copy link
Member

Keno commented Aug 11, 2019

Looks like MPFR implements the cited paper: https://gforge.inria.fr/scm/viewvc.php/mpfr/trunk/src/nrandom.c?view=markup. Any reason we don't just hook this up?

@StefanKarpinski
Copy link
Member

Seems like a good project for someone to tackle!

@StefanKarpinski StefanKarpinski added good first issue Indicates a good issue for first-time contributors to Julia help wanted Indicates that a maintainer wants help on an issue or pull request labels Aug 12, 2019
@rfourquet
Copy link
Member

Any reason we don't just hook this up?

I guess this would be easy, but AFAIU, MPFR doesn't allow to pass our own random RNGs. So if we want to do this, we should IMHO first wrap GMP RNG into a proper Julia type, and then provide only randn(::GMP_RNG, ...).

@StefanKarpinski
Copy link
Member

Or patch GMP to allow arbitrary RNGs—that might not be so hard and I bet they'd accept a patch.

@chriscoey
Copy link

bump! this is sorely missing. anyone looking for a project could try this.

@rfourquet
Copy link
Member

AFAIU, MPFR doesn't allow to pass our own random RNGs

Actually I was wrong (unless this changed recently), you can pass your RNG, albeit in a quite involved way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bignums BigInt and BigFloat good first issue Indicates a good issue for first-time contributors to Julia help wanted Indicates that a maintainer wants help on an issue or pull request randomness Random number generation and the Random stdlib
Projects
None yet
8 participants