Skip to content
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

Merged
merged 6 commits into from
Feb 3, 2025
Merged

Conversation

TomAFrench
Copy link
Member

Description

Problem*

Resolves

Summary*

This got broken in #79

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@TomAFrench TomAFrench changed the title fix: correct batch inversion fix: correct batch inversion function Jan 31, 2025
accumulator = __mul::<_, MOD_BITS>(params, accumulator, x[idx]);
result[idx] = T0;
}
assert(__mul::<_, MOD_BITS>(params, T0, x[idx]) == __one::<N>());
Copy link
Contributor

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);
Copy link
Contributor

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

Copy link
Contributor

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]);
Copy link
Contributor

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()

Copy link
Contributor

@kashbrti kashbrti left a 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

@TomAFrench TomAFrench merged commit 976d3ef into main Feb 3, 2025
8 checks passed
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants