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

ndarray-rand with Complex and default PRNG #681

Open
termoshtt opened this issue Aug 3, 2019 · 2 comments
Open

ndarray-rand with Complex and default PRNG #681

termoshtt opened this issue Aug 3, 2019 · 2 comments

Comments

@termoshtt
Copy link
Member

I am considering a plan to port ndarray_linalg::generate::random feature into ndarray-rand crate. It is not depends on non-Ruat code (=LAPACK), and I think it will be useful for non-linalg users.

I'd like to improve the current API in the following two points. These are partially done in ndarray-linalg implementation.

Complex support

Default PRNG

  • Most ndarray users will seek ndarray_rand::random((n, n)) which does not need to initialize PRNG manually.
  • They will not need CSPRNG, but rand::thread_rng returns CSPRNG. For Monte-Calro or randomized algorithm usage, Mersenne twister will be good choice. I've re-implement SFMT in pure-Rust with std::arch.
@LukeMathWalker
Copy link
Member

For complex support, how should we proceed (once they update to rand 0.7)? Should we let the end-user pull in num-complex to get complex distributions or are you suggesting we should pull in num-complex in ndarray-rand directly?

On default PRNG, I do agree that a CSPRNG is probably overkill as the default RNG for random - if we were to use SFMT I assume we would need a fallback for non x86/x86_64 architectures, am I correct?

@bluss
Copy link
Member

bluss commented Sep 1, 2019

The thread_rng doesn't seem like a high quality CSPRNG but the point is taken - that one is probably overkill. Ndarray-rand has never defaulted to it - as is documented. ("The default RNG is a fast automatically seeded rng (currently rand::rngs::SmallRng seeded from rand::thread_rng).")

And picking a new default with a good motivation sounds like a great idea.

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

No branches or pull requests

3 participants