View source: R/scheme-switching.R
| eval_scheme_switching_setup | R Documentation |
With switching set up in both directions, a comparison is done by
switching CKKS values to FHEW, evaluating the sign there, and
switching the result back (CKKS with real data and
Feature$SCHEMESWITCH).
eval_scheme_switching_setup(cc, schswchparams)
eval_scheme_switching_key_gen(cc, key_pair, lwesk)
eval_compare_switch_precompute(cc, p_lwe = 0L, scale_sign = 1, unit = FALSE)
eval_compare_scheme_switching(
ct1,
ct2,
num_ctxts = 0L,
num_slots = 0L,
p_lwe = 0L,
scale_sign = 1,
unit = FALSE
)
eval_min_scheme_switching(
ct,
public_key,
num_values = 0L,
num_slots = 0L,
p_lwe = 0L,
scale_sign = 1
)
eval_min_scheme_switching_alt(
ct,
public_key,
num_values = 0L,
num_slots = 0L,
p_lwe = 0L,
scale_sign = 1
)
eval_max_scheme_switching(
ct,
public_key,
num_values = 0L,
num_slots = 0L,
p_lwe = 0L,
scale_sign = 1
)
eval_max_scheme_switching_alt(
ct,
public_key,
num_values = 0L,
num_slots = 0L,
p_lwe = 0L,
scale_sign = 1
)
cc |
A CKKS |
schswchparams |
A SchSwchParams object. The setup fills its
CKKS fields from |
key_pair |
The |
lwesk |
The |
p_lwe |
Integer; the FHEW plaintext modulus, |
scale_sign |
Numeric; the scale applied before the sign is
taken. Default |
unit |
Logical; whether the input messages are normalized to
the unit circle. Default |
ct1, ct2, ct |
|
num_ctxts |
Integer; number of values to compare, |
num_slots |
Integer; number of CKKS slots, |
public_key |
The |
num_values |
Integer; number of values to take the minimum or
maximum of, |
eval_scheme_switching_setup() creates the FHEW context inside cc
and returns its secret key; eval_scheme_switching_key_gen()
generates the keys for both directions.
eval_compare_switch_precompute() fixes the FHEW plaintext modulus
and the scale of the comparison.
eval_compare_scheme_switching() returns a ciphertext whose slots
hold 1 where ct1 < ct2 and 0 elsewhere.
eval_min_scheme_switching() and eval_max_scheme_switching()
return the minimum or maximum of the first num_values slots (a
power of two) and its index; set up the context with
set_compute_argmin(params, TRUE) for them. The index is one-hot
encoded over num_values slots unless the parameters say
otherwise (set_one_hot_encoding()). The slots after the first of
the value, and after the index, hold no meaningful data. The _alt
forms use more FHEW operations, for higher precision at a higher
cost (set_use_alt_argmin(params, TRUE)).
eval_scheme_switching_setup(): an LWEPrivateKey.
eval_compare_scheme_switching(): a Ciphertext. The minimum
and maximum functions: a list of two Ciphertext objects, the
value and its index. The others: cc, invisibly.
eval_ckks_to_fhew(), eval_fhew_to_ckks()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.