Skip to content
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 inverse_of_unit() for padics #13539

Closed
saraedum opened this issue Sep 26, 2012 · 11 comments
Closed

Add inverse_of_unit() for padics #13539

saraedum opened this issue Sep 26, 2012 · 11 comments

Comments

@saraedum
Copy link
Member

Currently, the padics lack an inverse_of_unit() method:

sage: (-1).inverse_of_unit()
-1
sage: ZpCA(3)(-1).inverse_of_unit()
AttributeError

The drawback with simply using ~ is that it puts the result in the fraction field and it can be annoying to always convert it back to the original ring when implementing general algorithms for all padics rings and fields:

sage: t = ZpCA(3,2)(-1)
sage: t
2 + 2*3 + O(3^2)
sage: t.parent()
3-adic Ring with capped absolute precision 2
sage: ~t
2 + 2*3 + O(3^2)
sage: (~t).parent()
3-adic Field with capped relative precision 2

The attached patch implements a method inverse_of_unit() and fixes a conversion error that came up when testing it.

Depends on #13600

Component: padics

Author: Julian Rueth

Reviewer: David Roe

Merged: sage-5.8.beta2

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

@saraedum saraedum added this to the sage-5.4 milestone Sep 26, 2012
@saraedum

This comment has been minimized.

@roed314
Copy link
Contributor

roed314 commented Oct 11, 2012

comment:3

I'm happy with the changes to LocalGenericElement. There are changes to pAdicZZpXCAElement though that I think make the code less readable (and actually change the functionality a bit). Were those intended?

@saraedum
Copy link
Member Author

Dependencies: #13600

@saraedum
Copy link
Member Author

comment:4

You're right. I didn't understand these changes myself anymore now. I tried to put them into a separate ticket and turned them into something that is hopefully more readable #13600.

@roed314
Copy link
Contributor

roed314 commented Oct 15, 2012

comment:5

Cool. Once you update the patch here and it passes doctests I can give it a positive review

@saraedum
Copy link
Member Author

comment:6

I removed the pieces that are now in #13600. I also added a copyright notice since it was missing (I took the years from the repo history).

@roed314
Copy link
Contributor

roed314 commented Oct 15, 2012

comment:7

Your apply failed against 5.4.rc1 according to patchbot. I'm a bit confused though, since I'm succeeding.... If you don't know what's going on I'll take a look later.

@saraedum
Copy link
Member Author

Attachment: trac_13539.patch.gz

@roed314
Copy link
Contributor

roed314 commented Oct 24, 2012

comment:8

Okay, patchbot is succeeding now, so I'll give this a positive review.

@roed314
Copy link
Contributor

roed314 commented Oct 24, 2012

Reviewer: David Roe

@jdemeyer jdemeyer removed this from the sage-5.4 milestone Oct 24, 2012
@jdemeyer jdemeyer added this to the sage-5.8 milestone Feb 19, 2013
@jdemeyer jdemeyer removed the pending label Feb 19, 2013
@jdemeyer
Copy link

Merged: sage-5.8.beta2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants