pub struct Variance(pub f64);Expand description
A distribution parameter that uses the variance as representation
§Example:
use concrete_core::prelude::{DispersionParameter, Variance};
let params = Variance::from_variance(2_f64.powi(-50));
assert_eq!(params.get_standard_dev(), 2_f64.powf(-25.));
assert_eq!(params.get_log_standard_dev(), -25.);
assert_eq!(params.get_variance(), 2_f64.powf(-25.).powi(2));
assert_eq!(params.get_modular_standard_dev(32), 2_f64.powf(32. - 25.));
assert_eq!(params.get_modular_log_standard_dev(32), 32. - 25.);
assert_eq!(
params.get_modular_variance(32),
2_f64.powf(32. - 25.).powi(2)
);Tuple Fields§
§0: f64Implementations§
Trait Implementations§
Source§impl DispersionParameter for Variance
impl DispersionParameter for Variance
Source§fn get_standard_dev(&self) -> f64
fn get_standard_dev(&self) -> f64
Returns the standard deviation of the distribution, i.e. $\sigma = 2^p$.
Source§fn get_variance(&self) -> f64
fn get_variance(&self) -> f64
Returns the variance of the distribution, i.e. $\sigma^2 = 2^{2p}$.
Source§fn get_log_standard_dev(&self) -> f64
fn get_log_standard_dev(&self) -> f64
Returns base 2 logarithm of the standard deviation of the distribution, i.e.
$\log_2(\sigma)=p$
Source§fn get_modular_standard_dev(&self, log2_modulus: u32) -> f64
fn get_modular_standard_dev(&self, log2_modulus: u32) -> f64
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{q-p}$.Source§fn get_modular_variance(&self, log2_modulus: u32) -> f64
fn get_modular_variance(&self, log2_modulus: u32) -> f64
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{2(q-p)}$.Source§fn get_modular_log_standard_dev(&self, log2_modulus: u32) -> f64
fn get_modular_log_standard_dev(&self, log2_modulus: u32) -> f64
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $q-p$.Source§impl PartialOrd for Variance
impl PartialOrd for Variance
impl Copy for Variance
impl StructuralPartialEq for Variance
Auto Trait Implementations§
impl Freeze for Variance
impl RefUnwindSafe for Variance
impl Send for Variance
impl Sync for Variance
impl Unpin for Variance
impl UnwindSafe for Variance
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more