-
Notifications
You must be signed in to change notification settings - Fork 596
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
Added Cairo extended GCD function #3138
Conversation
7feac96
to
841f4fa
Compare
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.
Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @yuvalsw)
corelib/src/integer.cairo
line 1540 at r2 (raw file):
// TODO(yuval): use signed integers once supported. /// Extended GCD: finds numbers (g, s, t, sign_s, sign_t) such that /// g = gcd(x, y) = sign_s*s*a + sign_t*t*b
extract to another module.
(maybe even a submodule of an algorithm module)
corelib/src/test/integer_test.cairo
line 7 at r1 (raw file):
use integer:: { u16_sqrt , u32_sqrt , u64_sqrt , u8_sqrt , BoundedInt , u128_wrapping_sub } ; #[test] fn test_u8_operators() {
you probably need to update formatter.
Code quote:
use option::OptionTrait;
use integer::
{ u16_sqrt , u32_sqrt , u64_sqrt , u8_sqrt , BoundedInt , u128_wrapping_sub } ; #[test]
fn test_u8_operators() {
5443af2
to
9da77ee
Compare
5a29344
to
0571927
Compare
50b0990
to
0aa03fc
Compare
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.
Reviewed 2 of 5 files at r3.
Reviewable status: 2 of 8 files reviewed, 3 unresolved discussions (waiting on @yuvalsw)
corelib/src/math.cairo
line 26 at r4 (raw file):
>( a: NonZero<T>, b: NonZero<T> ) -> (T, T, bool, T, bool) {
is there a a real need for both bools?
corelib/src/math.cairo
line 49 at r4 (raw file):
fn is_one(self: T) -> bool; /// Returns whether self is not equal to 1, the multiplicative identity element. fn is_non_one(self: T) -> bool;
i think we don't need these:
- not used here.
- as efficient if you -1 and use
is_zero
.
Code quote:
/// Returns whether self is equal to 1, the multiplicative identity element.
fn is_one(self: T) -> bool;
/// Returns whether self is not equal to 1, the multiplicative identity element.
fn is_non_one(self: T) -> bool;
Previously, orizi wrote…
This is orthogonal to this PR (I moved it from integer.cairo). |
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.
Reviewable status: 2 of 8 files reviewed, 3 unresolved discussions (waiting on @orizi)
corelib/src/integer.cairo
line 1540 at r2 (raw file):
Previously, orizi wrote…
extract to another module.
(maybe even a submodule of an algorithm module)
Done.
corelib/src/math.cairo
line 26 at r4 (raw file):
Previously, orizi wrote…
is there a a real need for both bools?
Done.
corelib/src/test/integer_test.cairo
line 7 at r1 (raw file):
Previously, orizi wrote…
you probably need to update formatter.
Done.
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.
Reviewed 2 of 6 files at r4, 2 of 2 files at r5.
Reviewable status: 6 of 8 files reviewed, all discussions resolved
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.
Reviewed 1 of 6 files at r4, 2 of 2 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
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.
Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
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.
Reviewed 2 of 2 files at r8, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
This change is