Improve features (#215)
This commit is contained in:
+10
-9
@@ -12,24 +12,25 @@ readme = "README.md"
|
|||||||
keywords = ["machine-learning", "statistical", "ai", "optimization", "linear-algebra"]
|
keywords = ["machine-learning", "statistical", "ai", "optimization", "linear-algebra"]
|
||||||
categories = ["science"]
|
categories = ["science"]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["datasets", "serde"]
|
|
||||||
ndarray-bindings = ["ndarray"]
|
|
||||||
datasets = ["rand_distr", "std"]
|
|
||||||
std = ["rand/std", "rand/std_rng"]
|
|
||||||
# wasm32 only
|
|
||||||
js = ["getrandom/js"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
approx = "0.5.1"
|
approx = "0.5.1"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
ndarray = { version = "0.15", optional = true }
|
ndarray = { version = "0.15", optional = true }
|
||||||
num-traits = "0.2.12"
|
num-traits = "0.2.12"
|
||||||
num = "0.4"
|
num = "0.4"
|
||||||
rand = { version = "0.8", default-features = false, features = ["small_rng"] }
|
rand = { version = "0.8.5", default-features = false, features = ["small_rng"] }
|
||||||
rand_distr = { version = "0.4", optional = true }
|
rand_distr = { version = "0.4", optional = true }
|
||||||
serde = { version = "1", features = ["derive"], optional = true }
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["serde", "datasets"]
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
ndarray-bindings = ["dep:ndarray"]
|
||||||
|
datasets = ["dep:rand_distr", "std"]
|
||||||
|
std = ["rand/std_rng", "rand/std"]
|
||||||
|
# wasm32 only
|
||||||
|
js = ["getrandom/js"]
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
getrandom = { version = "0.2", optional = true }
|
getrandom = { version = "0.2", optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use rand::Rng;
|
|
||||||
|
|
||||||
use num_traits::{Float, Signed};
|
use num_traits::{Float, Signed};
|
||||||
|
|
||||||
use crate::numbers::basenum::Number;
|
use crate::numbers::basenum::Number;
|
||||||
@@ -58,6 +56,7 @@ impl FloatNumber for f64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rand() -> f64 {
|
fn rand() -> f64 {
|
||||||
|
use rand::Rng;
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
rng.gen()
|
rng.gen()
|
||||||
}
|
}
|
||||||
@@ -99,6 +98,7 @@ impl FloatNumber for f32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rand() -> f32 {
|
fn rand() -> f32 {
|
||||||
|
use rand::Rng;
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
rng.gen()
|
rng.gen()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ impl RealNumber for f64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rand() -> f64 {
|
fn rand() -> f64 {
|
||||||
|
// TODO: to be implemented, see issue smartcore#214
|
||||||
1.0
|
1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user