[−][src]Trait concrete_lib::types::Types
Associated Types
Loading content...Associated Constants
Loading content...Required methods
pub fn round_to_closest_multiple(x: Self, base_log: usize, level: usize) -> Self
[src]
pub fn torus_small_sign_decompose(res: &mut [Self], val: Self, base_log: usize)
[src]
pub fn signed_decompose_one_level(
value: Self,
previous_carry: Self,
base_log: usize,
level: usize
) -> (Self, Self)
[src]
value: Self,
previous_carry: Self,
base_log: usize,
level: usize
) -> (Self, Self)
pub fn torus_to_f64(item: Self) -> f64
[src]
pub fn f64_to_torus(item: f64) -> Self
[src]
pub fn set_val_at_level_l(val: Self, base_log: usize, level_l: usize) -> Self
[src]
pub fn torus_binary_representation(n: Self, base_log: usize) -> String
[src]
pub fn torus_binary_comparison(t1: Self, t2: Self) -> String
[src]
Implementations on Foreign Types
impl Types for u32
[src]
type STorus = i32
pub const TORUS_BIT: usize
[src]
pub const TORUS_MAX: u32
[src]
pub fn round_to_closest_multiple(x: u32, base_log: usize, level: usize) -> u32
[src]
Rounds a torus element to its closest torus element with only lv_tot * log_b MSB that can be different from zero
Comments
- warning: panic when base_log*level >= TORUS_BIT if not in release mode
Example with binary representations:
round_to_closest_multiple(1100100...0,2,2) -> 11010...0 we will only keep 2*2 = 4 MSB so we can put a dot where the rounding happens, which is after the 4th MSB: 1100.1 is rounded to 1101
Arguments
x
- element of the Torus to be roundedbase_log
- number of bits for the base B (B=2^base_log)level
- number of blocks of the gadget matrix
Output
- the rounded Torus element
Tests
- test_round_to_closest_multiple: unit test
- test_panic_round_to_closest_multiple: panic test when base_log*level == TORUS_BIT
pub fn torus_small_sign_decompose(res: &mut [u32], val: u32, base_log: usize)
[src]
Computes a signed decomposition of a Torus element The base is B = 2^base_log We end up with coefficients in [-B/2, B/2[
Comments
- used for the gadget decomposition
- len(res) equals level
- takes into account the case where a block is equals to 11...11 (only ones) to get the right carry
Arguments
res
- a tensor of signed integers (output)val
- the Torus element to be decomposedbase_log
- number of bits for the base B (B=2^base_log)
Tests
- test_torus_small_sign_decompose: unit test
pub fn signed_decompose_one_level(
value: u32,
previous_carry: u32,
base_log: usize,
level: usize
) -> (u32, u32)
[src]
value: u32,
previous_carry: u32,
base_log: usize,
level: usize
) -> (u32, u32)
This function only gives the level-th piece of the signed decomposition of a value. To do so, it needs the value, the decomposition parameters and the carry from the previous level We end up with coefficients in [-B/2, B/2[
Arguments
value
- the Torus value we are decomposingprevious_carry
- the carry form the level+1 levelbase_log
- number of bits for the base B (B=2^base_log)level
- the level of the piece of decomposition we want
Tests
- test_rsd: unit test
pub fn torus_to_f64(item: u32) -> f64
[src]
pub fn f64_to_torus(item: f64) -> u32
[src]
pub fn set_val_at_level_l(val: u32, base_log: usize, level_l: usize) -> u32
[src]
Returns a Torus element with a some bits a the right place according to the base_log and level decomposition
Arguments
val
- a Torus element containing on its LSB some bit we want to move at a precise placebase_log
- decomposition log2 baselevel_l
- the desired level
Output
- a torus element build as desired
pub fn torus_binary_representation(n: u32, base_log: usize) -> String
[src]
Output a string with a binary representation of n (a torus element) if base_log!=0 then bits are packed from MSB to LSD into words of logbase bits if base_log==0 then all bits are in one word
Arguments
n
- the Torus element we want its representationbase_log
- decomposition log2 base
Output
- a String with the binary representation
pub fn torus_binary_comparison(t1: u32, t2: u32) -> String
[src]
impl Types for u64
[src]
type STorus = i64
pub const TORUS_BIT: usize
[src]
pub const TORUS_MAX: u64
[src]
pub fn round_to_closest_multiple(x: u64, base_log: usize, level: usize) -> u64
[src]
Rounds a torus element to its closest torus element with only lv_tot * log_b MSB that can be different from zero
Comments
- warning: panic when base_log*level >= TORUS_BIT if not in release mode
Example with binary representations:
round_to_closest_multiple(1100100...0,2,2) -> 11010...0 we will only keep 2*2 = 4 MSB so we can put a dot where the rounding happens, which is after the 4th MSB: 1100.1 is rounded to 1101
Arguments
x
- element of the Torus to be roundedbase_log
- number of bits for the base B (B=2^base_log)level
- number of blocks of the gadget matrix
Output
- the rounded Torus element
Tests
- test_round_to_closest_multiple: unit test
- test_panic_round_to_closest_multiple: panic test when base_log*level == TORUS_BIT
pub fn torus_small_sign_decompose(res: &mut [u64], val: u64, base_log: usize)
[src]
Computes a signed decomposition of a Torus element The base is B = 2^base_log We end up with coefficients in [-B/2, B/2[
Comments
- used for the gadget decomposition
- len(res) equals level
- takes into account the case where a block is equals to 11...11 (only ones) to get the right carry
Arguments
res
- a tensor of signed integers (output)val
- the Torus element to be decomposedbase_log
- number of bits for the base B (B=2^base_log)
Tests
- test_torus_small_sign_decompose: unit test
pub fn signed_decompose_one_level(
value: u64,
previous_carry: u64,
base_log: usize,
level: usize
) -> (u64, u64)
[src]
value: u64,
previous_carry: u64,
base_log: usize,
level: usize
) -> (u64, u64)
This function only gives the level-th piece of the signed decomposition of a value. To do so, it needs the value, the decomposition parameters and the carry from the previous level We end up with coefficients in [-B/2, B/2[
Arguments
value
- the Torus value we are decomposingprevious_carry
- the carry form the level+1 levelbase_log
- number of bits for the base B (B=2^base_log)level
- the level of the piece of decomposition we want
Tests
- test_rsd: unit test
pub fn torus_to_f64(item: u64) -> f64
[src]
pub fn f64_to_torus(item: f64) -> u64
[src]
pub fn set_val_at_level_l(val: u64, base_log: usize, level_l: usize) -> u64
[src]
Returns a Torus element with a some bits a the right place according to the base_log and level decomposition
Arguments
val
- a Torus element containing on its LSB some bit we want to move at a precise placebase_log
- decomposition log2 baselevel_l
- the desired level
Output
- a torus element build as desired
pub fn torus_binary_representation(n: u64, base_log: usize) -> String
[src]
Output a string with a binary representation of n (a torus element) if base_log!=0 then bits are packed from MSB to LSD into words of logbase bits if base_log==0 then all bits are in one word
Arguments
n
- the Torus element we want its representationbase_log
- decomposition log2 base
Output
- a String with the binary representation