fhelium.benchmarks.standalone.packed_matrix_vector
Register a deterministic one-GPU packed matrix-vector workload.
CORRECTNESS_ATOL
constant View source
python
CORRECTNESS_ATOL = 3e-051
matrix_and_vector
function View source
python
def matrix_and_vector(size: int, *, seed: int) -> tuple[torch.Tensor, torch.Tensor]: ...1
Create the versioned CPU-binary64 matrix and input vector.
periodic_slots
function View source
python
def periodic_slots(values: torch.Tensor, num_slots: int) -> torch.Tensor: ...1
Repeat one logical vector across the complete CKKS slot vector.
cyclic_diagonal_slots
function View source
python
def cyclic_diagonal_slots(matrix: torch.Tensor, rotation_step: int, num_slots: int) -> torch.Tensor: ...1
Align one cyclic diagonal with torch.roll(x, rotation_step).
prepare_packed_matvec
function View source
python
def prepare_packed_matvec(engine: fh.CkksEngine, matrix: torch.Tensor, source: fh.Ciphertext) -> tuple[tuple[fh.Plaintext, ...], dict[int, fh.RotationKey]]: ...1
Materialize operation-ready diagonals and exact rotation keys.
evaluate_packed_matvec
function View source
python
def evaluate_packed_matvec(engine: fh.CkksEngine, source: fh.Ciphertext, diagonals: Sequence[fh.Plaintext], rotation_keys: Mapping[int, fh.RotationKey], *, hoist_chunk_size: int) -> fh.Ciphertext: ...1
Evaluate a cyclic-diagonal matrix-vector product in bounded chunks.
Each chunk batches its rotated ciphertexts, forward NTT, plaintext products, and additive reduction. The chunk sum returns to coefficient domain and is rescaled once before joining the global accumulator.