콘텐츠로 이동

lossy_bootstrap

Engine.lossy_bootstrap(ciphertext, relinearization_key, conjugation_key, lossy_bootstrap_key)
곱셈 횟수를 다시 늘려줍니다. 손실 부트스트랩 키를 사용하여 간이 부트스트랩 키를 사용하는 경우보다 추가적인 메모리가 사용되지만 더 좋은 성능을 가집니다. 엔진이 부트스트랩용으로 생성된 경우에만 사용할 수 있습니다.
  • 인풋:
    • Ciphertext: 값이 -1 에서 1 이내의 값이어야 합니다. 레벨도 최소한 손실 부트스트랩 키 생성에 사용된 stage_count만큼은 필요합니다.
    • RelinearizationKey
    • ConjugationKey
    • LossyBootstrapKey
  • 아웃풋:
    • Ciphertext: 레벨은 16 - stage_count 입니다. 손실 부트스트랩 키 생성에 사용된 stage_count에 따라 레벨이 변합니다.
from desilofhe import Engine

engine = Engine(use_bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
relinearization_key = engine.create_relinearization_key(secret_key)
conjugation_key = engine.create_conjugation_key(secret_key)
lossy_bootstrap_key = engine.create_lossy_bootstrap_key(
    secret_key, stage_count=3
)

message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
bootstrapped = engine.lossy_bootstrap(
    ciphertext, relinearization_key, conjugation_key, lossy_bootstrap_key
)
Engine.lossy_bootstrap(ciphertext, relinearization_key, conjugation_key, rotation_key, small_bootstrap_key, stage_count=3)
곱셈 횟수를 다시 늘려줍니다. 간이 부트스트랩 키를 사용하여 메모리 사용이 적지만 느립니다. 엔진이 부트스트랩용으로 생성된 경우에만 사용할 수 있습니다.
  • 인풋:
    • Ciphertext: 값이 -1 에서 1 이내의 값이어야 합니다. 레벨도 최소한 손실 부트스트랩 키 생성에 사용된 stage_count만큼은 필요합니다.
    • RelinearizationKey
    • ConjugationKey
    • RotationKey
    • SmallBootstrapKey
    • stage_count: optional
      • 부트스트래핑 알고리즘의 coefficient to slot, slot to coefficient 단계에서 사용될 곱셈 횟수를 지정합니다. 기본값은 3이고, 3 ~ 5를 지원합니다. 클수록 부트스트래핑이 빠르지만 최종 결과값의 곱셈 횟수가 줄어듭니다.
  • 아웃풋:
    • Ciphertext: 레벨은 16 - stage_count 입니다. 손실 부트스트랩 키 생성에 사용된 stage_count에 따라 레벨이 변합니다.
from desilofhe import Engine

engine = Engine(use_bootstrap=True)
secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)
relinearization_key = engine.create_relinearization_key(secret_key)
conjugation_key = engine.create_conjugation_key(secret_key)
rotation_key = engine.create_rotation_key(secret_key)
small_bootstrap_key = engine.create_small_bootstrap_key(secret_key)

message = [-1, 0, 1]
ciphertext = engine.encrypt(message, public_key, level=0)
bootstrapped = engine.lossy_bootstrap(
    ciphertext,
    relinearization_key,
    conjugation_key,
    rotation_key,
    small_bootstrap_key,
)

bootstrapped_stage_count_5 = engine.lossy_bootstrap(
    ciphertext,
    relinearization_key,
    conjugation_key,
    rotation_key,
    small_bootstrap_key,
    stage_count=5,
)

Stage Count

기본적으로 3, 4, 5를 지원합니다. 희소 부트스트랩의 경우 다음 값들을 지원합니다.

key_size slot_count 1 2 3 4 5
medium 1
medium 2
medium 3
medium 4
medium 5
medium 6
medium 7
medium 8
medium 9
medium 10
medium 11
medium 12
medium 13
medium 14
large 3
large 4
large 5
large 6
large 7
large 8
large 9
large 10
large 11
large 12
large 13
large 14