sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 482 forks source link

faster conversions from number field to interval field #23447

Open videlec opened 7 years ago

videlec commented 7 years ago

The conversion of number field elements to real interval field is slow (that was actually the main reason for the slowness constated in #23388). We implement a function cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec) that provides an interval approximation of a number field element. We then refactorize the methods floor() and _richcmp_() and provide a straightforward implementation of _real_mpfi_().

This improves the overall performance of any method of number field element using approximation.

Depends on #23402

Component: number fields

Author: Vincent Delecroix

Branch/Commit: u/vdelecroix/23447 @ 4a40fbe

Issue created by migration from https://trac.sagemath.org/ticket/23447

videlec commented 7 years ago

Description changed:

--- 
+++ 
@@ -1 +1,3 @@
-The conversion of number field elements to real interval field is slow (that was actually the main reason for the slow down constated in #23388). We implement a method `_real_mpfi_` on them (and refactor a bit `__richcmp__()` and `floor()`). This improves the overall performance of anything using approximation.
+The conversion of number field elements to real interval field is slow (that was actually the main reason for the slow down constated in #23388). We implement a a function `cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec)` that provides an interval approximation of a number field element. We then refactorize the methods `floor()` and `_richcmp_()` and provide a straightforward implementation of `_real_mpfi()`.
+
+This improves the overall performance of anything using approximation.
videlec commented 7 years ago

Commit: 4a40fbe

videlec commented 7 years ago

Author: Vincent Delecroix

videlec commented 7 years ago

Branch: u/vdelecroix/23447

videlec commented 7 years ago

New commits:

0146c8623388: faster floor for nf element
8124ba523402: faster hash for nf elements
4a40fbe23447: faster conversion nf -> rif
videlec commented 7 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,3 @@
-The conversion of number field elements to real interval field is slow (that was actually the main reason for the slow down constated in #23388). We implement a a function `cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec)` that provides an interval approximation of a number field element. We then refactorize the methods `floor()` and `_richcmp_()` and provide a straightforward implementation of `_real_mpfi()`.
+The conversion of number field elements to real interval field is slow (that was actually the main reason for the slowness constated in #23388). We implement a a function `cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec)` that provides an interval approximation of a number field element. We then refactorize the methods `floor()` and `_richcmp_()` and provide a straightforward implementation of `_real_mpfi()`.

-This improves the overall performance of anything using approximation.
+This improves the overall performance of any method of number field element using approximation.
videlec commented 7 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1,3 @@
-The conversion of number field elements to real interval field is slow (that was actually the main reason for the slowness constated in #23388). We implement a a function `cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec)` that provides an interval approximation of a number field element. We then refactorize the methods `floor()` and `_richcmp_()` and provide a straightforward implementation of `_real_mpfi()`.
+The conversion of number field elements to real interval field is slow (that was actually the main reason for the slowness constated in #23388). We implement a function `cdef void nf_elem_get_mpfi(mpfi_t x, NumberFieldElement a, mp_prec_t prec)` that provides an interval approximation of a number field element. We then refactorize the methods `floor()` and `_richcmp_()` and provide a straightforward implementation of `_real_mpfi_()`.

 This improves the overall performance of any method of number field element using approximation.
videlec commented 7 years ago
comment:5

doctest failures...

sage -t --long --warn-long 37.3 src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py  # 3 doctests failed
sage -t --long --warn-long 37.3 src/sage/schemes/projective/projective_morphism.py  # 4 doctests failed
sage -t --long --warn-long 37.3 src/sage/groups/matrix_gps/finitely_generated.py  # 1 doctest failed
sage -t --long --warn-long 37.3 src/sage/schemes/curves/curve.py  # 1 doctest failed
videlec commented 7 years ago
comment:6

Replying to @videlec:

doctest failures...

Most are because of #23402... so they are fixed there.