Struct concrete::parameters::StandardDev
[−]pub struct StandardDev(pub f64);
Available on crate feature
booleans
only.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
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
impl Clone for StandardDev
impl Clone for StandardDev
fn clone(&self) -> StandardDev
fn clone(&self) -> StandardDev
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl Debug for StandardDev
impl Debug for StandardDev
impl<'de> Deserialize<'de> for StandardDev
impl<'de> Deserialize<'de> for StandardDev
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
impl DispersionParameter for StandardDev
impl DispersionParameter for StandardDev
fn get_standard_dev(&self) -> f64
fn get_standard_dev(&self) -> f64
Returns the standard deviation of the distribution, i.e. $\sigma = 2^p$.
fn get_variance(&self) -> f64
fn get_variance(&self) -> f64
Returns the variance of the distribution, i.e. $\sigma^2 = 2^{2p}$.
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$ Read more
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}$.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)}$.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$.impl PartialEq<StandardDev> for StandardDev
impl PartialEq<StandardDev> for StandardDev
fn eq(&self, other: &StandardDev) -> bool
fn eq(&self, other: &StandardDev) -> bool
impl PartialOrd<StandardDev> for StandardDev
impl PartialOrd<StandardDev> for StandardDev
fn partial_cmp(&self, other: &StandardDev) -> Option<Ordering>
fn partial_cmp(&self, other: &StandardDev) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const 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 moreimpl Serialize for StandardDev
impl Serialize for StandardDev
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 RefUnwindSafe for StandardDev
impl Send for StandardDev
impl Sync for StandardDev
impl Unpin for StandardDev
impl UnwindSafe for StandardDev
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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