__init__.pyi
637 B · python · 15 lines
1from typing import Any, Literal23from numpy.typing import NDArray45def is_balanced(code: int, n: int) -> bool:6 """Reports whether the packed function outputs one on exactly half of its inputs."""78def nonlinearity(code: int, n: int) -> int:9 """Returns how far the packed function sits from every affine function, zero when it is one."""1011def sac(code: int, n: int) -> float:12 """Returns the mean chance that flipping one input bit flips the output, 0.5 at full avalanche."""1314def walsh_spectrum(code: int, n: int) -> list[int]:15 """Returns the Walsh spectrum of an n-input boolean function packed as a truth-table code."""