-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correct batch inversion function #117
Conversation
src/fns/unconstrained_ops.nr
Outdated
accumulator = __mul::<_, MOD_BITS>(params, accumulator, x[idx]); | ||
result[idx] = T0; | ||
} | ||
assert(__mul::<_, MOD_BITS>(params, T0, x[idx]) == __one::<N>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an assertion for easier debugging later if something goes wrong, it wasn't showing the call stack properly.
result[idx] = T0; | ||
} | ||
assert(__mul::<_, MOD_BITS>(params, T0, x[idx]) == __one::<N>()); | ||
result = result.push_front(T0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order was reversed, so we should push things to the front instead of the back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it in a later commit
assert(__mul::<_, MOD_BITS>(params, T0, x[idx]) == __one::<N>()); | ||
result = result.push_front(T0); | ||
} else { | ||
result = result.push_front([0; N]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result.push_front
does not update the slice, and we should rather do result = result.push_front()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I fixed the problem. the rest LGTM
Description
Problem*
Resolves
Summary*
This got broken in #79
Additional Context
PR Checklist*
cargo fmt
on default settings.