-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add ZZ[i] and QQ[i] #1168
Add ZZ[i] and QQ[i] #1168
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1168 +/- ##
==========================================
+ Coverage 86.82% 87.16% +0.33%
==========================================
Files 71 74 +3
Lines 26681 27332 +651
==========================================
+ Hits 23166 23824 +658
+ Misses 3515 3508 -7
Continue to review full report at Codecov.
|
@albinahlback, do you have ideas for the canonicalization of the gcdx coefficients in ZZ[i]? |
I have a feeling that a generalized Euclidean algorithm should return the canonical coefficients. What I mean is that via these definitions, one should be able to generalize this proof for canonical Bézout coefficients. |
I was thinking less of having the canonicity defined by an algorithm and more of having it defined by a set of easy-to-check conditions, like the fmpz_xgcd_canonical_bezout docs. I already have the gcd satsifying -pi/4 < angle(gcd(,)) <= pi/4. so that the gcd is as close the positive real axis as possible. |
Ah, yeah. Let me think of a definition. |
I think the easiest way to deal with this is to assume that the numbers are coprime (in sense of Gaussian integers). Let And if This should be canonical Bézout coefficients. However, if this holds along with that they are unique, I do not know. |
Thank you for working on this. I am fine with doing this in principle. As long as there is a good way to convert between these new elements, and existing number field elements? Also, supporting all the features we have for the isomorphic existing field types. Like, can we also factorize in polynomial rings over QQ[i]? |
Yes, I am discussing with thofma how to make it work as a number field/ring. |
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.
There are a bunch of deepcopy
, like in conj
, which I am not sure about.
According to the documentation here
The results of deepcopy and all arithmetic operations, including powering and
division can be assumed to be new objects without other references being held,
as can objects returned from constructors.
I don't think we should extend this to other random methods. But I am happy to hear your thoughts on this.
I don't know. I was thinking of |
I think is a good start. Pros:
Cons:
|
Yay! Let's get this in.
Yes, please do this (in a separate PR). |
context: #1110, #1072
I would be nice to have a ZZ[i] and QQ[i] that embed directly (i.e. without user intervention) into the complex numbers.
If you are asking yourself if we really need this, consider the following:
BigInt
is tofmpz
asComplex{BigInt}
is tofmpzi
.Rational{BigInt}
is tofmpq
asComplex{Rational{BigInt}}
is tofmpqi
.fmpzi
has a Euclidean structure that we should be able to usenf_elem
, thefmpzi
andfmpqi
embed directly into the complex numbers so that conversions and roundings betweenacb
are possible.If the ZZi and QQi are completely unacceptable, please let me know and I will stop. Otherwise, I will finish the rest of the interface. Also, @thofma, I don't care any more what
numerator(::fmpqi)
anddenominator(::fmpqi)
do. They can do whatever you want. And, I don't even care if this is changed: