-
Notifications
You must be signed in to change notification settings - Fork 322
Re-export rand
distributions
#663
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
Merged
LukeMathWalker
merged 14 commits into
rust-ndarray:master
from
LukeMathWalker:re-export-rand-distribution
Sep 10, 2019
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c0d2c6a
Re-export distribution trait and implemented dists
LukeMathWalker 8b6618e
Export from the crate module
LukeMathWalker e55986d
Adapt doc tests
LukeMathWalker bd60a36
Run cargo fmt
LukeMathWalker 5214fba
Merge branch 'master' into re-export-rand-distribution
LukeMathWalker 0eea9e4
Re-export the whole rand crate. Adjust docs, readme and examples.
LukeMathWalker 0f79978
Refactor ndarray-rand readme and changelog.
LukeMathWalker 29d4c4b
Re-export rand-distr. Update docs accordingly.
LukeMathWalker a6b25f9
Keep stuff in sync
LukeMathWalker d664498
Update docs to use rand_distr
LukeMathWalker d964d5d
Add doc example to random_using with seedable rng (Isaac64)
LukeMathWalker 080cc54
Run cargo fmt
LukeMathWalker 1963d36
Remove extern crate from doc tests
LukeMathWalker 5e6022f
Remove extern crate from README
LukeMathWalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
ndarray-rand | ||
============ | ||
|
||
Constructors for randomized arrays: `rand`'s integration with `ndarray`. | ||
|
||
Example | ||
======= | ||
|
||
Generate a 2-dimensional array with shape `(2,5)` and elements drawn from a uniform distribution | ||
over the `(0., 10.)` interval: | ||
|
||
```rust | ||
use ndarray::Array; | ||
use ndarray_rand::RandomExt; | ||
use ndarray_rand::rand_distr::Uniform; | ||
|
||
fn main() { | ||
let a = Array::random((2, 5), Uniform::new(0., 10.)); | ||
println!("{:8.4}", a); | ||
// Example Output: | ||
// [[ 8.6900, 6.9824, 3.8922, 6.5861, 2.4890], | ||
// [ 0.0914, 5.5186, 5.8135, 5.2361, 3.1879]] | ||
} | ||
``` | ||
|
||
Dependencies | ||
============ | ||
|
||
``ndarray-rand`` depends on ``rand`` 0.7. | ||
|
||
[`rand`](https://docs.rs/rand/0.7.0/rand/) and [`rand-distr`](https://docs.rs/rand_distr/0.2.1/rand_distr/) are | ||
re-exported as sub-modules, `ndarray_rand::rand` and `ndarray_rand::rand_distr` respectively. | ||
Please rely on these submodules for guaranteed version compatibility. | ||
|
||
If you want to use a random number generator or distribution from another crate | ||
with `ndarray-rand`, you need to make sure that the other crate also depends on the | ||
same version of `rand`. Otherwise, the compiler may return errors saying | ||
that the items are not compatible (e.g. that a type doesn't implement a | ||
necessary trait). | ||
|
||
Recent changes | ||
============== | ||
|
||
0.10.0 | ||
------ | ||
|
||
- Require `rand` 0.7 | ||
- Require Rust 1.32 or later | ||
- Re-export `rand` as a submodule, `ndarray_rand::rand` | ||
- Re-export `rand-distr` as a submodule, `ndarray_rand::rand_distr` | ||
|
||
Check _[Changelogs](https://github.com/rust-ndarray/ndarray/ndarray-rand/RELEASES.md)_ to see | ||
the changes introduced in previous releases. | ||
|
||
|
||
License | ||
======= | ||
|
||
Dual-licensed to be compatible with the Rust project. | ||
|
||
Licensed under the Apache License, Version 2.0 | ||
http://www.apache.org/licenses/LICENSE-2.0 or the MIT license | ||
http://opensource.org/licenses/MIT, at your | ||
option. This file may not be copied, modified, or distributed | ||
except according to those terms. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Recent Changes | ||
-------------- | ||
|
||
- 0.10.0 | ||
|
||
- Require `rand` 0.7 | ||
- Require Rust 1.32 or later | ||
- Re-export `rand` as a submodule, `ndarray_rand::rand` | ||
- Re-export `rand-distr` as a submodule, `ndarray_rand::rand_distr` | ||
|
||
- 0.9.0 | ||
|
||
- Require rand 0.6 | ||
|
||
- 0.8.0 | ||
|
||
- Require ndarray 0.12 | ||
- Require rand 0.5 | ||
|
||
- 0.7.0 | ||
|
||
- Require ndarray 0.11 | ||
- Require rand 0.4 | ||
|
||
- 0.6.1 | ||
|
||
- Clean up implementation of ``Array::random`` by @v-shmyhlo | ||
|
||
- 0.6.0 | ||
|
||
- Require ndarray 0.10.0 | ||
|
||
- 0.5.0 | ||
|
||
- Require ndarray 0.9 | ||
|
||
- 0.4.0 | ||
|
||
- Require ndarray 0.8 | ||
|
||
- 0.3.0 | ||
|
||
- Require ndarray 0.7 | ||
|
||
- 0.2.0 | ||
|
||
- Require ndarray 0.6 | ||
|
||
- 0.1.0 | ||
|
||
- Initial release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be my ignorance, I thought we had pub extern crate for re-exporting, but I'm unsure what difference it makes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never heard of
pub extern crate <...>
!Digging around, it seems they have exactly the same effect ( nix-rust/nix#694 ).
Using
mod
has the plus of being more explicit in my eyes, given that it uses the "standard" visibility mechanism of the 2018 edition.