Trait concrete_npe::cross::Cross [−][src]
pub trait Cross: Sized {
fn external_product(
dimension: usize,
l_gadget: usize,
base_log: usize,
polynomial_size: usize,
var_trgsw: f64,
var_trlwe: f64
) -> f64;
fn bootstrap(
lwe_dimension: usize,
rlwe_dimension: usize,
l_gadget: usize,
base_log: usize,
polynomial_size: usize,
var_bsk: f64
) -> f64;
fn cmux(
var_rlwe_0: f64,
var_rlwe_1: f64,
var_trgsw: f64,
dimension: usize,
polynomial_size: usize,
base_log: usize,
l_gadget: usize
) -> f64;
}
Required methods
fn external_product(
dimension: usize,
l_gadget: usize,
base_log: usize,
polynomial_size: usize,
var_trgsw: f64,
var_trlwe: f64
) -> f64
Implementations on Foreign Types
Return the variance of the external product given a set of parameters. To see how to use it, please refer to the test of the external product. Arguments
dimension
- the size of the RLWE maskl_gadget
- number of elements for the Torus decompositionbase_log
- decomposition base of the gadget matrixpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1var_trgsw
- noise variance of the TRGSWvar_trlwe
- noise variance of the TRLWE
Output
- Returns the variance of the output RLWE
Warning
- only correct for the external product inside a bootstrap
Example
use concrete_npe::Cross ;
type Torus = u32;
// settings
let dimension: usize = 3 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_trgsw: f64 = f64::powi(2., -38) ;
let var_trlwe: f64 = f64::powi(2., -40) ;
// Computing the noise
let var_external_product = <Torus as Cross>::external_product(dimension, l_gadget,
base_log, polynomial_size, var_trgsw, var_trlwe) ;
Return the variance of the cmux given a set of parameters. To see how to use it, please refer to the test of the cmux. Arguments
var_rlwe_0
- noise variance of the first TRLWEvar_rlwe_1
- noise variance of the second TRLWEvar_trgsw
- noise variance of the TRGSWdimension
- the size of the RLWE maskpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1base_log
- decomposition base of the gadget matrixl_gadget
- number of elements for the Torus decomposition
Output
- Returns the variance of the output RLWE
Warning
- only correct for the cmux inside a bootstrap
Example
use concrete_npe::Cross ;
type Torus = u32;
// settings
let dimension: usize = 3 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_trgsw: f64 = f64::powi(2., -38) ;
let var_trlwe_0: f64 = f64::powi(2., -40) ;
let var_trlwe_1: f64 = f64::powi(2., -40) ;
// Computing the noise
let var_cmux = <Torus as Cross>::cmux(var_trlwe_0, var_trlwe_1, var_trgsw,
dimension, polynomial_size, base_log, l_gadget) ;
Return the variance of output of a bootstrap given a set of parameters. To see how to use it, please refer to the test of the bootstrap. Arguments
lwe_dimension
- size of the LWE maskrlwe_dimension
- size of the RLWE maskl_gadget
- number of elements for the Torus decompositiondimension
- the size of the RLWE maskbase_log
- decomposition base of the gadget matrixpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1var_bsk
- variance of the bootstrapping key
Output
- Returns the variance of the output RLWE
Example
use concrete_npe::Cross ;
type Torus = u32;
// settings
let rlwe_dimension: usize = 3 ;
let lwe_dimension: usize = 630 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_bsk: f64 = f64::powi(2., -38) ;
// Computing the noise
let var_bootstrap = <Torus as Cross>::bootstrap(lwe_dimension, rlwe_dimension,
l_gadget, base_log, polynomial_size, var_bsk) ;
Return the variance of the external product given a set of parameters. To see how to use it, please refer to the test of the external product. Arguments
dimension
- the size of the RLWE maskl_gadget
- number of elements for the Torus decompositionbase_log
- decomposition base of the gadget matrixpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1var_trgsw
- noise variance of the TRGSWvar_trlwe
- noise variance of the TRLWE
Output
- Returns the variance of the output RLWE
Warning
- only correct for the external product inside a bootstrap
Example
use concrete_npe::Cross ;
type Torus = u64;
// settings
let dimension: usize = 3 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_trgsw: f64 = f64::powi(2., -38) ;
let var_trlwe: f64 = f64::powi(2., -40) ;
// Computing the noise
let var_external_product = <Torus as Cross>::external_product(dimension, l_gadget,
base_log, polynomial_size, var_trgsw, var_trlwe) ;
Return the variance of the cmux given a set of parameters. To see how to use it, please refer to the test of the cmux. Arguments
var_rlwe_0
- noise variance of the first TRLWEvar_rlwe_1
- noise variance of the second TRLWEvar_trgsw
- noise variance of the TRGSWdimension
- the size of the RLWE maskpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1base_log
- decomposition base of the gadget matrixl_gadget
- number of elements for the Torus decomposition
Output
- Returns the variance of the output RLWE
Warning
- only correct for the cmux inside a bootstrap
Example
use concrete_npe::Cross ;
type Torus = u64;
// settings
let dimension: usize = 3 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_trgsw: f64 = f64::powi(2., -38) ;
let var_trlwe_0: f64 = f64::powi(2., -40) ;
let var_trlwe_1: f64 = f64::powi(2., -40) ;
// Computing the noise
let var_cmux = <Torus as Cross>::cmux(var_trlwe_0, var_trlwe_1, var_trgsw,
dimension, polynomial_size, base_log, l_gadget) ;
Return the variance of output of a bootstrap given a set of parameters. To see how to use it, please refer to the test of the bootstrap. Arguments
lwe_dimension
- size of the LWE maskrlwe_dimension
- size of the RLWE maskl_gadget
- number of elements for the Torus decompositiondimension
- the size of the RLWE maskbase_log
- decomposition base of the gadget matrixpolynomial_size
- number of coefficients of the polynomial e.g. degree + 1var_bsk
- variance of the bootstrapping key
Output
- Returns the variance of the output RLWE
Example
use concrete_npe::Cross ;
type Torus = u64;
// settings
let rlwe_dimension: usize = 3 ;
let lwe_dimension: usize = 630 ;
let l_gadget: usize = 4 ;
let base_log: usize = 7 ;
let polynomial_size: usize = 1024 ;
let var_bsk: f64 = f64::powi(2., -38) ;
// Computing the noise
let var_bootstrap = <Torus as Cross>::bootstrap(lwe_dimension, rlwe_dimension,
l_gadget, base_log, polynomial_size, var_bsk) ;