sagemath / sage

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

padic _ntl_rep_abs incorrect for extension fields #13651

Open saraedum opened 11 years ago

saraedum commented 11 years ago

Currently, _ntl_rep_abs() is incorrect for some extension fields::

sage: K=Zp(3,3)
sage: R.<a>=K[]
sage: L.<a>=K.extension(a^2-3)
sage: L(3)._ntl_rep_abs()
([57], 0)

The correct result here would be ([3],0).

The attached patch fixes this.

CC: @roed314

Component: padics

Keywords: sd59, days71

Author: Julian Rueth

Branch/Commit: u/saraedum/ticket/13651 @ c3875b9

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

saraedum commented 11 years ago
comment:1

Attachment: trac_13651.patch.gz

There was a problem in _internal_lshift(). I rewrote it to use multiplications of the form x^e/p which can be done without a precision loss.

It initially took me a while to understand what _ntl_rep_abs() does. I reformatted it heavily in this patch but I (hopefully) did not change what it does at all. I hope it's easier to understand now.

saraedum commented 11 years ago
comment:2

The doctests in the padics directory pass. Let's see what the patchbot thinks about everything else.


This also fixes a todo in the code:

sage: ZZ(W(5)) # todo: this should be different... 
381469726562505 

It seems that roed wrote that todo a few years ago. (added him as CC)

saraedum commented 10 years ago

Branch: u/saraedum/ticket/13651

saraedum commented 10 years ago

Changed keywords from none to sd59

vbraun commented 10 years ago

Commit: b87ff51

vbraun commented 10 years ago
comment:9

looks good but branch doesn't apply currently


New commits:

b87ff51Trac #13651: fixed a precision problem in _internal_lshift(), _ntl_rep_abs() of padics
saraedum commented 10 years ago
comment:10

(changed the status so it shows up in my list of tickets needing work)

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

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

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

Changed commit from b87ff51 to c3875b9

saraedum commented 8 years ago

Changed keywords from sd59 to sd59, days71