sagemath / sage

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

New implementation of unramified p-adics using FLINT and templates #14304

Closed roed314 closed 8 years ago

roed314 commented 11 years ago

Reimplement Qq using FLINT.

Depends on #20210

CC: @fredrik-johansson @jpflori @saraedum

Component: padics

Keywords: sd59, days71

Author: Julian Rüth, David Roe

Branch/Commit: 56b357c

Reviewer: David Roe, Julian Rüth, Aly Deines

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

saraedum commented 10 years ago

Changed branch from u/roed/ticket/14304 to u/saraedum/ticket/14304

saraedum commented 10 years ago

Changed keywords from none to sd59

saraedum commented 10 years ago

Changed commit from cda1d75 to c4348c2

saraedum commented 10 years ago
comment:52

I'm happy with the changes roed made since my last positive_review. So from my point of view this could go back to positive_review once somebody reviewed my few changes and if the patchbot is happy.


New commits:

f11fb44Merge branch 'develop' into ticket/14304
cce5076adapt to the new version of FLINT's padic_ctx_init
994be79Fixed a typo in linkage to FLINT for qadics
c4348c2fixed a doctest in padic factor
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from c4348c2 to 5b42f9b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d4d1353Remove some trailing whitespace
13902d3Fix copy() for qadic coercion/conversion maps
3c1d9adAdd `__richcmp__` for qadic element classes
5b42f9bFixed doctests.
saraedum commented 10 years ago
comment:54

I hope that this fixes all the bugs the patchbot detected.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

2fcdde8Fix copy() for qadic coercion maps from capped absolute rings
f33bd5bMinor change to exception handling in MatrixSpace.matrix()
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from 5b42f9b to f33bd5b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from f33bd5b to c7ffd25

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

c7ffd25Fix copy() for qadic conversion maps to capped absolute rings
fchapoton commented 10 years ago
comment:58

needs rebase

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from c7ffd25 to 9fecbdd

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

9fecbddMerge branch 'develop' into t/14304/ticket/14304
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 9fecbdd to 5ba4124

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

5ba4124Merge branch 'develop' into t/14304/ticket/14304
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 5ba4124 to 5e17cdb

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

e6bc498fixed some hashing doctests of q-adics
5e17cdbDo not rely on generic conversion to Rational when converting from finite fields to p-adics
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

2c3a710implement _cache_key for q-adics
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 5e17cdb to 2c3a710

jdemeyer commented 8 years ago
comment:63

Just a few technical comments (I don't plan to formally review this):

  1. You don't need to add include_dirs = [SAGE_INC + '/flint'] (just add flint/ to the path to the .h files)
  2. You don't need to add __richcmp__ calling _richcmp
  3. You don't need to add __hash__ which just raises TypeError: all Elements are now unhashable by default.
  4. For consistency with other .pxd files, could you move all declarations of FLINT types to sage/libs/flint/types.pxd?
  5. In this block
            try:
                padic_ctx_init(self.ctx, self.fprime, 0, prec_cap, PADIC_SERIES)
            except:
                mpz_clear(self.top_power)
                raise

given that padic_ctx_init is a C function, how could it ever raise a Python exception? Moreover, I find it bad style to use except:, you should be more explicit and catch except BaseException: instead (the reason I say this is because most people write except: by mistake).

jdemeyer commented 8 years ago

Changed dependencies from #12555, #12173 to none

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

ab07bc4remove unnecessary include_dirs for FLINT from module_list.py
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 2c3a710 to ab07bc4

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

52425beMerge branch 'develop' into t/14304/ticket/14304
2a1f293remove unnecessary implementation of `__hash__` and __richcmp__
6fbb0d7fix conversion from residue field to q-adic fields
70c780dMerge branch 'develop' into t/14304/ticket/14304
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from ab07bc4 to 70c780d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 70c780d to 0ab73f6

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0ab73f6Convert to p-adic residue field if there is a coercion
jdemeyer commented 8 years ago
comment:67

Why this change?

diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
index 03470ef..c5620e1 100644
--- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
+++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx
@@ -18,6 +18,9 @@ quaternion algebras and quaternion algebras over number fields.
 #                  http://www.gnu.org/licenses/
 #*****************************************************************************

+from sage.libs.flint.fmpz cimport *
+from sage.libs.flint.fmpz_poly cimport *
+from sage.libs.flint.ntl_interface cimport *
 from sage.structure.element cimport AlgebraElement, RingElement, ModuleElement, Element
 from sage.algebras.quatalg.quaternion_algebra_element cimport QuaternionAlgebraElement_abstract
 from sage.rings.rational cimport Rational
jdemeyer commented 8 years ago
comment:68

There are also some strange added imports in src/sage/rings/polynomial/...

jdemeyer commented 8 years ago
comment:69

Similarly:

diff --git a/src/sage/libs/flint/ntl_interface.pxd b/src/sage/libs/flint/ntl_interface.pxd
index 7cea729..6b88b9b 100644
--- a/src/sage/libs/flint/ntl_interface.pxd
+++ b/src/sage/libs/flint/ntl_interface.pxd
@@ -2,6 +2,8 @@ from types cimport fmpz_t, fmpz_poly_t

 from sage.libs.ntl.ntl_ZZ_decl cimport ZZ_c
 from sage.libs.ntl.ntl_ZZX_decl cimport ZZX_c
+from sage.libs.flint.fmpz cimport fmpz_t
+from sage.libs.flint.fmpz_poly cimport fmpz_poly_t

 cdef extern from "flint/NTL-interface.h":
     void fmpz_poly_get_ZZX(ZZX_c output, fmpz_poly_t poly)
saraedum commented 8 years ago
comment:70

These imports happened because we fixed flint build errors by importing the necessary symbols. We just imported them in different places than what got into develop did. So the merge did not catch this conflict it seems. Thanks for pointing these out.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 0ab73f6 to 63d90c6

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

63d90c6remove duplicate imports
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

932d5ddRevert "remove unnecessary implementation of `__hash__` and __richcmp__"
94dda77remove unnecessary implementation of __richcmp__
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 63d90c6 to 94dda77

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d2ced66Fix conversion from finite rings to q-adic fields
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 94dda77 to d2ced66

jdemeyer commented 8 years ago

Dependencies: #19646

jdemeyer commented 8 years ago
comment:75

Conflicts with 6.10.beta6. If you fix this conflict, I can easily merge #19646.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from d2ced66 to 1238235

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

1238235Merge branch 'develop' into t/14304/ticket/14304
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3a68eb5Merge branch 'develop' of git://trac.sagemath.org/sage into t/14304/ticket/14304
33df900fix build errors in padics/pow_computer_flint
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 1238235 to 33df900

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

99fea64silence deprecation warning in padics factory
b522bebfixed incorrect doctests related to p-adic hashing
73303b8fixed identity morphism for unramified p-adics
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 33df900 to 73303b8

saraedum commented 8 years ago
comment:79

All doctests in rings/ now pass (have not checked with --long.)

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

89a56a0implement residue() for q-adic elements
12c7cc3Fix p-adic doctests
8291b03implement conversion from polynomials to q-adics
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 73303b8 to 8291b03

jdemeyer commented 8 years ago

Changed dependencies from #19646 to none