AlphaEvolve's best known result is a way to multiply two complex matrices with 48 scalar multiplications. The paper finds such algorithms as low-rank decompositions of a three-dimensional tensor: the rank of the decomposition is exactly the number of scalar multiplications. Build that tensor, check a decomposition against it exactly, and use a decomposition to multiply matrices. The index convention below is this problem's; the paper does not print one.
matmul_tensor(m, n, p) returns the integer array of shape for the product of an matrix and an matrix. Flatten each matrix row by row, so has index , has index and has index (all zero-based). Then
round_half(X) rounds every entry of an array to the nearest multiple of . For a complex array the real and imaginary parts are rounded separately. (The paper rounds each element to the nearest integer or half-integer before checking, so that the result is exact.)
exact_rank(U, V, W, m, n, p) takes factor matrices of shapes , and . Round the three with round_half, form
and return the integer if equals matmul_tensor(m, n, p) exactly, else None. Raise ValueError if a factor has the wrong number of rows or the three do not have the same number of columns.
multiply_with_decomposition(A, B, U, V, W) multiplies A () by B () using the factors as given (no rounding): compute the products and return the array with .