Skip to content

Commit

Permalink
perf: do not store zero mul constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Mar 5, 2024
1 parent 91cd05e commit 833fd73
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/cs/scs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ func (builder *builder) Mul(i1, i2 frontend.Variable, in ...frontend.Variable) f
if len(vars) == 0 {
return builder.cs.ToBigInt(k)
}
if k.IsZero() {
return 0
}
for i := range vars {
if vars[i].Coeff.IsZero() {
return 0
}
}
l := builder.mulConstant(vars[0], k)

return builder.splitProd(l, vars[1:])
Expand Down

0 comments on commit 833fd73

Please sign in to comment.