Open
Description
How can I express a constraint that depends on a variable number of signals instead of a fixed one?
For example, let's say I want to prove I have computed the inner product of two given vectors, then, I could have a template like this:
template InnerProd(n) {
signal input a[n];
signal input b[n];
signal output out;
// First compute the inner product
var x = 0;
for(var i = 0; i < n; i++){
x += a[i]*b[i];
}
out <-- x;
// Now check
// so, at this point, I would like to use a single R1CS constraint to write something like
out === a[0]*b[0] + a[1]*b[1] + .... + a[n-1]*b[n-1];
}
component main {public [a, b]} = InnerProd(10); // fix a value of n
How can I express out === a[0]*b[0] + a[1]*b[1] + .... + a[n-1]*b[n-1]
with a single constraint?
Metadata
Metadata
Assignees
Labels
No labels