pub struct StandardDev(pub f64);
Expand description
A distribution parameter that uses the standard deviation as representation.
§Example:
use concrete_core::prelude::{DispersionParameter, StandardDev};
let params = StandardDev::from_standard_dev(2_f64.powf(-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(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: f64
Implementations§
Source§impl StandardDev
impl StandardDev
pub fn from_standard_dev(std: f64) -> StandardDev
pub fn from_modular_standard_dev(std: f64, log2_modulus: u32) -> StandardDev
Trait Implementations§
Source§impl Clone for StandardDev
impl Clone for StandardDev
Source§fn clone(&self) -> StandardDev
fn clone(&self) -> StandardDev
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 StandardDev
impl Debug for StandardDev
Source§impl<'de> Deserialize<'de> for StandardDev
impl<'de> Deserialize<'de> for StandardDev
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardDev, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardDev, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DispersionParameter for StandardDev
impl DispersionParameter for StandardDev
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 PartialEq for StandardDev
impl PartialEq for StandardDev
Source§impl PartialOrd for StandardDev
impl PartialOrd for StandardDev
Source§impl Serialize for StandardDev
impl Serialize for StandardDev
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for StandardDev
impl StructuralPartialEq for StandardDev
Auto Trait Implementations§
impl Freeze for StandardDev
impl RefUnwindSafe for StandardDev
impl Send for StandardDev
impl Sync for StandardDev
impl Unpin for StandardDev
impl UnwindSafe for StandardDev
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