Bit extraction
import numpy as np
from concrete import fhe
inputset = fhe.inputset(fhe.uint6)
for bit_extraction in [False, True]:
def is_even(x):
return (
x % 2 == 0
if not bit_extraction
else 1 - fhe.bits(x)[0]
)
compiler = fhe.Compiler(is_even, {"x": "encrypted"})
circuit = compiler.compile(inputset)
if not bit_extraction:
print(f"without bit extraction -> {int(circuit.complexity):>11_} complexity")
else:
print(f" with bit extraction -> {int(circuit.complexity):>11_} complexity")Last updated
Was this helpful?