A small kernel of code for playing with Galois fields of arbitrary characteristic
Revision | f08e01af6b80b197a203f3c61b449905829e011d (tree) |
---|---|
Time | 2021-07-19 05:32:33 |
Author | Eric Hopper <hopper@omni...> |
Commiter | Eric Hopper |
Fix comment. (Why did I use '' and not '*'?!?)
@@ -7,13 +7,15 @@ | ||
7 | 7 | |
8 | 8 | def extended_gcd(x: int, y: int): |
9 | 9 | """Return a tuple 't' with three elements such that: |
10 | - t[0) * x + t[1] * y == t[2] | |
10 | + t[0] * x + t[1] * y == t[2] | |
11 | 11 | |
12 | 12 | t[2] will be either 0 or 1. If it is zero, then x and y are not |
13 | 13 | relatively prime. If it is one, then they are. |
14 | 14 | |
15 | 15 | This makes use of Euclid's algorithm for finding the GCD, but extends it |
16 | 16 | to keep track of the extra data returned in t[0] and t[1]. |
17 | + | |
18 | + GCD = Greatest Common Denominator | |
17 | 19 | """ |
18 | 20 | sx = 1 if x > 0 else -1 |
19 | 21 | x = abs(x) |