A Context is an object containing information for HE, such as parameter for HE, whether to generate keys, which keys will be loaded on memory, which to use GPU, and so on.

heaan_sdk.Context(
  params,
  key_dir_path = ".",
  generate_keys = FALSE,
  load_keys = "none",
  ...
)

Arguments

parameter:

(HEParameter) - Parameter for HE.

key_dir_path:

(Optional: string) - Path to the key.

generate_keys:

(Optional: logical, default FALSE) - Determine whether you generate new keys or use existing keys.

load_keys:

(Optional: string, default "none") - Determine which type of keys to be loaded. If load_keys = "all", load both public and secret keys. If load_keys = "pk", load public keys only. If load_keys = "enc", load encryption key only. If load_keys = "dec", load decryption (secret) key only.

use_gpu:

(Optional: logical, default TRUE) - If true, send input items to GPU. else, send it to CPU.

rk_indices:

(Optional list, default "none") - Indices of left rotation indices for additional rotation keys.

gpu_list:

(Optional list) - GPU device IDs identified by CUDA driver. Check how many GPUs are installed in your system and how enumerated by CUDA driver first before trying manual assignment.

Value

context, heaan_sdk.Context

Examples

if (FALSE) {
params <- heaan_sdk.HEParameter("FGb", "real")
context <- heaan_sdk.Context(
         params,
         key_dir_path = "keys",
         load_keys = "all",
         generate_keys = TRUE)
}
if (FALSE) {
params <- heaan_sdk.HEParameter("FGb", "pi")
context <- heaan_sdk.Context(
           params,
           key_dir_path = "keys-pi",
           load_keys = "pk",
           generate_keys = TRUE)
}