Define extended GCD, combined GCD+LCM#19
Conversation
6accdbc to
f6f06f8
Compare
|
Rebased, PTAL |
src/lib.rs
Outdated
There was a problem hiding this comment.
Let's use separate x and y, so we can document it something like this:
Bézout's identity — Let a and b be integers with greatest common divisor d. Then, there exist integers x and y such that ax + by = d.
Then we also don't have to worry about array_clone.
src/lib.rs
Outdated
There was a problem hiding this comment.
Hmm, it's a little annoying to have SubAssign in the API just for this, and AFAICT it's only needed because you're working through &mut. If the closure used values instead, or if you just flattened these three calls, then you could move and then reassign r.0 just fine.
There was a problem hiding this comment.
Maybe we should require Signed though -- I believe it's useless for unsigned integers, since one of the coefficients must be negative, except the degenerate case with zeros.
|
@cuviper All done, PTAL |
|
Thanks! bors r+ |
Build failed |
|
Sorry, that was my fault. bors r+ |
Build succeeded |
No description provided.