- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 570
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
Comparisons in quadratic number field #13213
Comments
comment:1
I had a short look at your patch.
|
Changed author from vdelecroix to Vincent Delecroix |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:5
Thanks again for the patch. A few comments:
|
Reviewer: Burcin Erocal |
comment:6
Done and done.
We loose speed (~1 micro sec) by doing this. I quickly look at the code of comparison for Integer. The comparison is directly implemented inside
What do you mean by too close ? How do I certify that my float comparison is accurate enough ?
Actually there is no problem since we compute the sign of an expression of the form a^2 + b^2 D where a and b are both integers (and one of them is non null) and D is a square free integer. Hence the sign is never 0.
Sure but that way we call twice mpz_sgn(i)... I may change it if you prefer. Actually, the part where a lot of time is lost is the check for embedding
By replacing it by
I pass from 4 micro second to 2 micro seconds. That way comparison without embedding for positive discriminant will be equivalent to comparison with the standard embedding. This is in the last version of the patch. What do you think about that ? |
This comment has been minimized.
This comment has been minimized.
comment:8
The code for comparison introduces a small bug as it ask to the parent whether the embedding is standard or not (via the boolean attribute _standard_embedding). But the latter was not defined for Cyclotomic field of order 3,4,6 (which are the ones which are quadratic). In that case, the attribute _standard_embedding is created at the initialization of the cyclotomic field. The new patch takes care of this. |
This comment has been minimized.
This comment has been minimized.
comment:10
Because there are many parents for quadratic elements, I was obliged to test whether the parent has a method '_standard_embedding' or not. I correct all tests (many output have changed) and waiting for patchbot and reviewer! |
comment:12
I corrected the two last tests that have failed... |
comment:13
How does this patch here relate to #7160? |
comment:14
In the ticket title "real number field", should it say "quadratic number field" instead? |
comment:16
Replying to @videlec:
I don't care very much, but I think it should be clear how the various tickets relate to eachother. Also #10064 is related, at least it has #7160 as dependency. |
This comment has been minimized.
This comment has been minimized.
comment:18
Just had a quick look at your patch. How about using |
comment:19
Hello, Actually, a lot of time is lost for asking questions to the parent. For quadratic number field, it is for asking about the attribute _standard_embedding. I build a new patch with a bint attribute added to NumberFieldElement_quadratic and the speed of comparison is divided by 10 (from 4 milliseconds to 400 nanoseconds). It will be updated as soon as possible. Vincent |
comment:27
Last minute modification: more tests, more docs. apply trac_13213-quadratic_field_comparison.patch |
comment:28
#7545 is possibly a related ticket. |
comment:29
There is a strange problem
|
comment:30
Replying to @videlec:
I got the problem... it was because there is a natural morphism implemented from the rational field to quadratic number field ( |
comment:31
apply trac_13213-quadratic_field_comparison.patch |
comment:32
I get a doctest failure with sage-5.10.beta2:
|
Attachment: trac_13213-quadratic_field_comparison.patch.gz |
comment:33
Replying to @vbraun:
Thanks for that. I got the same error on my computer and change the patch accordingly. Why was patchbot happy with the former patch ? apply trac_13213-quadratic_field_comparison.patch |
comment:34
The patchbot apparently doesn't check German docs. Enttäuschend! ;-) |
comment:35
All tests pass. |
Changed reviewer from Burcin Erocal to Burcin Erocal, Volker Braun |
Changed work issues from rebase 5.10.beta2 to none |
Merged: sage-5.10.beta4 |
The order of quadratic field with specified embedding is not induced from the order of RR and CC. More precisely we have
which is not compatible with the order of RR and
which is not compatible (!) with the order of CC.
The ticket implements the order for quadratic field (for which comparisons are made using only operations on integers).
Note:
There is no significant lost of speed as shown on the following timings.
Timings without the patch
Apply:
Component: number fields
Keywords: real number field, comparison
Author: Vincent Delecroix
Reviewer: Burcin Erocal, Volker Braun
Merged: sage-5.10.beta4
Issue created by migration from https://trac.sagemath.org/ticket/13213
The text was updated successfully, but these errors were encountered: