pub struct F32<S>(pub S);
Expand description
A wrapper type that allows casting f64 distributions to f32
use ndarray::Array;
use ndarray_rand::{RandomExt, F32};
use ndarray_rand::rand_distr::Normal;
let distribution_f64 = Normal::new(0., 1.).expect("Failed to create normal distribution");
let a = Array::random((2, 5), F32(distribution_f64));
println!("{:8.4}", a);
// Example Output:
// [[ -0.6910, 1.1730, 1.0902, -0.4092, -1.7340],
// [ -0.6810, 0.1678, -0.9487, 0.3150, 1.2981]]
Tuple Fields§
§0: S
Trait Implementations§
Source§impl<S> Distribution<f32> for F32<S>where
S: Distribution<f64>,
impl<S> Distribution<f32> for F32<S>where
S: Distribution<f64>,
impl<S: Copy> Copy for F32<S>
Auto Trait Implementations§
impl<S> Freeze for F32<S>where
S: Freeze,
impl<S> RefUnwindSafe for F32<S>where
S: RefUnwindSafe,
impl<S> Send for F32<S>where
S: Send,
impl<S> Sync for F32<S>where
S: Sync,
impl<S> Unpin for F32<S>where
S: Unpin,
impl<S> UnwindSafe for F32<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more