FHERMA
L3 · FUNCTIONALMEASURED

Encrypted Matrix Multiplication

encrypted-matrix-multiplication · spec v0.1.0 · 0 implementations · 6 runners

Create implementationSpecification

DESCRIPTION

Computes A × B for two encrypted matrices.

The arithmetic is the easy part. The difficulty is that a ciphertext is a flat vector of slots and a matrix is not, so a realization must choose how to lay the matrix out and then pay for that choice in data movement. The three families in use trade the same three resources differently:

  • row-wise encoding is general and needs d² slots, with roughly 2d multiplications and 2d + 3·log₂d − 2 rotations;
  • diagonal encoding can reach d + 2√d operations but wants d³ slots and depth three, and dropping to depth two costs many more rotations;
  • hypercube encodings reach depth two directly, at the price of leaving the standard scheme behind.

None of these is the kernel. The kernel is the product, and which layout wins at which size is precisely what benchmarking it answers.

INTERFACE

encrypted_matmul(
  in  ct     : Ciphertext  // the encrypted left matrix A
  in  ct_b   : Ciphertext  // the encrypted right matrix B
  out ct     : Ciphertext  // the encrypted product A × B
  ...               // anything else the realization needs — keys, context, encoding — is its own concern
)

PARAMETER SCHEMA

NAMETYPERANGE
rowsinteger1 – 2^12
innerinteger1 – 2^12
columnsinteger1 – 2^12
element_abs_maxnumber0.001 – 1000
target_precisionnumber0.5 – 1

The schema belongs to the kernel. Each implementation declares which part of it it supports.

CORRECTNESS

01The result equals the mathematical product of the two matrices within the declared precision.
02The output layout is stated and is usable as the input of a further multiplication, otherwise chaining costs a re-encoding nobody measured.
03Rectangular shapes behave as square ones do; supporting only the square case is a narrower coverage, not a different kernel.

SECURITY PROPERTIES

Both operands stay encrypted; neither the entries nor their layout reveal values.

ASSUMPTIONS

Matrix dimensions are public. Rotation keys, where a layout needs them, are supplied.

REFERENCES

Encrypted Matrix Multiplication · FHERMA