Python API
The yuenix package wraps the C ABI. It accepts and returns NumPy arrays. Every object is a context manager that frees its native handle on exit.
import yuenixyuenix.Context(device=0)
Section titled “yuenix.Context(device=0)”| Member | Description |
|---|---|
plan(profile, rotations=(), program=None) -> Plan |
profile is a yuenix.Profile, a JSON dict, or JSON bytes |
synchronize() |
Wait for queued GPU work |
import_evaluator(plan, data: bytes) -> Evaluator |
Evaluator from serialized keys |
load_ciphertext(plan, data: bytes) -> Ciphertext |
| Member | Description |
|---|---|
capabilities |
slots, input_level, output_level, program limits |
generate_keys() -> Keyset |
Keyset (key holder)
Section titled “Keyset (key holder)”| Member | Description |
|---|---|
evaluator() -> Evaluator |
Same-process evaluator |
export_evaluation_keys() -> bytes |
|
encrypt(values, level=None) -> Ciphertext |
values: real or complex array |
decrypt(ct) -> numpy.ndarray[complex128] |
|
register_aes_key(client, key: bytes) |
16-byte AES-128 key |
admit(obj) |
Verify GCM authentication for a transciphered result |
decrypt_vector(result) -> numpy.ndarray[float64] |
Evaluator
Section titled “Evaluator”Arithmetic: add, sub, mul, add_scalar, mul_scalar, rotate, conjugate, bootstrap, apply_function. Each accepts out= to reuse a ciphertext.
Comparison: compare, less_than, min, max, argmax, rank, topk_mask, sort.
Aggregation and transciphering: vectors(rows, dimensions, cipher=...) -> Vectors, transcipher(client, record).
Ciphertext
Section titled “Ciphertext”| Member | Description |
|---|---|
level |
Current level |
serialize() -> bytes |
Errors
Section titled “Errors”Failures raise yuenix.Error, which carries .status (a yuenix.Status value) and the library message. Authentication failures raise yuenix.AuthenticationError, a subclass of yuenix.Error.