Skip to content

Commit

Permalink
fix random sparsity test
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Aug 5, 2024
1 parent 5473c23 commit 67732d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/hydra/test_extension_field_modulo_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ def test_eval(circuit: tuple[ExtensionFieldModuloCircuit, list[ModuloCircuitElem
def generate_random_sparsity(
extension_degree: int, num_cases: int = 32
) -> list[list[int]]:
return [
sparsities = [
[random.choice([0, 1, 2]) for _ in range(extension_degree)]
for _ in range(num_cases)
]
for sparsity in sparsities:
if all(x == 0 for x in sparsity):
# Make sure there is at least one non-zero element somewhere
sparsity[random.randint(0, extension_degree - 1)] = random.choice([1, 2])
return sparsities


def test_eval_sparse(
Expand Down

0 comments on commit 67732d7

Please sign in to comment.