Struct concrete_commons::dispersion::LogStandardDev
source · [−]pub struct LogStandardDev(pub f64);
Expand description
A distribution parameter that uses the base-2 logarithm of the standard deviation as representation.
Example:
use concrete_commons::dispersion::{DispersionParameter, LogStandardDev};
let params = LogStandardDev::from_log_standard_dev(-25.);
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::<u32>(),
2_f64.powf(32. - 25.)
);
assert_eq!(params.get_modular_log_standard_dev::<u32>(), 32. - 25.);
assert_eq!(
params.get_modular_variance::<u32>(),
2_f64.powf(32. - 25.).powi(2)
);
let modular_params = LogStandardDev::from_modular_log_standard_dev::<u32>(22.);
assert_eq!(modular_params.get_standard_dev(), 2_f64.powf(-10.));
Tuple Fields
0: f64
Implementations
sourceimpl LogStandardDev
impl LogStandardDev
pub fn from_log_standard_dev(log_std: f64) -> LogStandardDev
pub fn from_modular_log_standard_dev<Uint>(log_std: f64) -> LogStandardDev where
Uint: UnsignedInteger,
Trait Implementations
sourceimpl Clone for LogStandardDev
impl Clone for LogStandardDev
sourcefn clone(&self) -> LogStandardDev
fn clone(&self) -> LogStandardDev
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for LogStandardDev
impl Debug for LogStandardDev
sourceimpl DispersionParameter for LogStandardDev
impl DispersionParameter for LogStandardDev
sourcefn get_standard_dev(&self) -> f64
fn get_standard_dev(&self) -> f64
Returns the standard deviation of the distribution, i.e. $\sigma = 2^p$.
sourcefn get_variance(&self) -> f64
fn get_variance(&self) -> f64
Returns the variance of the distribution, i.e. $\sigma^2 = 2^{2p}$.
sourcefn 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$ Read more
sourcefn get_modular_standard_dev<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
fn get_modular_standard_dev<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
For a Uint
type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{q-p}$.
sourcefn get_modular_variance<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
fn get_modular_variance<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
For a Uint
type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{2(q-p)}$.
sourcefn get_modular_log_standard_dev<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
fn get_modular_log_standard_dev<Uint>(&self) -> f64 where
Uint: UnsignedInteger,
For a Uint
type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $q-p$.
sourceimpl PartialEq<LogStandardDev> for LogStandardDev
impl PartialEq<LogStandardDev> for LogStandardDev
sourcefn eq(&self, other: &LogStandardDev) -> bool
fn eq(&self, other: &LogStandardDev) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &LogStandardDev) -> bool
fn ne(&self, other: &LogStandardDev) -> bool
This method tests for !=
.
sourceimpl PartialOrd<LogStandardDev> for LogStandardDev
impl PartialOrd<LogStandardDev> for LogStandardDev
sourcefn partial_cmp(&self, other: &LogStandardDev) -> Option<Ordering>
fn partial_cmp(&self, other: &LogStandardDev) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for LogStandardDev
impl StructuralPartialEq for LogStandardDev
Auto Trait Implementations
impl RefUnwindSafe for LogStandardDev
impl Send for LogStandardDev
impl Sync for LogStandardDev
impl Unpin for LogStandardDev
impl UnwindSafe for LogStandardDev
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more