Spartan icon indicating copy to clipboard operation
Spartan copied to clipboard

How to determine num_non_zero_entries

Open mottla opened this issue 2 years ago • 1 comments

I do not understand num_non_zero_entries. For a R1CS instance defined via matrices A,B,C, num_non_zero_entries refers to which matrix? It appears to be essential for the runtime of SNARK proof.

  • how can I determine it for a given R1CS instance (generated with NOVA for example)
  • what happens if it is set to a value that is larger than the actual number of non-zeros
  • what happens if it is set to a value that is smaller than the actual number of non-zeros
  • can it be abstracted away s.t. we do not have to think about this argument any longer?
  • why is it not relevant for the NIZK prover?

Thanks for this great project! Cheers

mottla avatar Sep 29 '23 11:09 mottla

R1CS instance is a 7-tuple: $(\mathbb{F}, A, B, C, \bf{io}, m, n)$, where $A, B, C$ are $m\times m$ matrices. num_non_zero_entries is actually the n in the R1CS instance, which dipct the sparsity and density of polynomials encoded by these matrices. When you get $A, B, C$ matrices, you can count the non-zero entries of the three matrices and define num_non_zero_entries with the max.

Xor0v0 avatar Jul 03 '24 06:07 Xor0v0