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: f64Implementations§
Source§impl LogStandardDev
impl LogStandardDev
pub fn from_log_standard_dev(log_std: f64) -> LogStandardDev
pub fn from_modular_log_standard_dev<Uint>(log_std: f64) -> LogStandardDevwhere
Uint: UnsignedInteger,
Trait Implementations§
Source§impl Clone for LogStandardDev
impl Clone for LogStandardDev
Source§fn clone(&self) -> LogStandardDev
fn clone(&self) -> LogStandardDev
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogStandardDev
impl Debug for LogStandardDev
Source§impl DispersionParameter for LogStandardDev
impl DispersionParameter for LogStandardDev
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<Uint>(&self) -> f64where
Uint: UnsignedInteger,
fn get_modular_standard_dev<Uint>(&self) -> f64where
Uint: UnsignedInteger,
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{q-p}$.Source§fn get_modular_variance<Uint>(&self) -> f64where
Uint: UnsignedInteger,
fn get_modular_variance<Uint>(&self) -> f64where
Uint: UnsignedInteger,
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $2^{2(q-p)}$.Source§fn get_modular_log_standard_dev<Uint>(&self) -> f64where
Uint: UnsignedInteger,
fn get_modular_log_standard_dev<Uint>(&self) -> f64where
Uint: UnsignedInteger,
For a
Uint type representing $\mathbb{Z}/2^q\mathbb{Z}$, we return $q-p$.Source§impl PartialEq for LogStandardDev
impl PartialEq for LogStandardDev
Source§impl PartialOrd for LogStandardDev
impl PartialOrd for LogStandardDev
impl Copy for LogStandardDev
impl StructuralPartialEq for LogStandardDev
Auto Trait Implementations§
impl Freeze for LogStandardDev
impl RefUnwindSafe for LogStandardDev
impl Send for LogStandardDev
impl Sync for LogStandardDev
impl Unpin for LogStandardDev
impl UnwindSafe for LogStandardDev
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