Index Mathematics Conjectures nbv lettuce Widgets

sample_uniform_r1cs!

Sample a random dense R1CS with a satisfying witness, as statics. R1CS

sample_uniform_r1cs! height, width

Samples a random R1CS together with a witness that satisfies it, for tests and benchmarks. The witness is uniform with 1 in entry 0; A and B are uniform matrices and C is chosen so that every row holds. The field safety rows for width are prepended, so the matrices have more than height rows.

Arguments

height
Static scalar, number of random rows.
width
Static scalar, witness length including the constant entry.

Returns

A tuple of four statics (a, b, c, wtns): the matrices as dense row-major vectors of rows * width elements and the witness of length width. It is an expression-form precompile used with a tuple assignment.

Constraints

None.

Example

(static a, static b, static c, static w) = sample_uniform_r1cs! 2, 3
static first = w[0]
concat! (len! w), first

Notes

Values are drawn from the system random number generator, so every compilation gives a different system and the program is not deterministic. Dense matrices grow as height * width; prefer sample_uniform_sparse_r1cs! for large systems.