Opened 7 years ago

Closed 4 years ago

#20239 closed enhancement (worksforme)

Make p-adic some_elements() non-trivial

Reported by: Julian Rüth Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: padics Keywords: days71, sd87, padicIMA
Cc: Merged in:
Authors: Julian Rüth Reviewers: Julian Rüth
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Julian Rüth)

some_elements() currently returns 0, 1, p. This makes most of our automated tests trivial. Something like this should be sufficient:

    def _some_elements(self):
        p = self(
        pi = self.uniformizer()
        e = self.ramification_index()

        yield p
        yield pi

        from sage.rings.all import NN
        for n in NN.some_elements():
            yield p**n
            yield pi**n

        if self.is_field():

        for x in self.residue_field().some_elements():
            yield self(x)
            yield self.teichmuller(x)

    def some_elements(self):
        Returns a list of elements in this ring.

        This is typically used for running generic tests (see :class:`TestSuite`).


            sage: Zp(2).some_elements()
            [0, 1 + O(2^20), 2 + O(2^21)]

        for x in self._some_elements():
            yield x
            if self.is_field() and not x.is_zero():
                yield ~x
            yield x<<1
            yield x<<self.precision_cap()-1)

however, it should also detect duplicates (using cache_key.)

Change History (9)

comment:1 Changed 7 years ago by Julian Rüth

Description: modified (diff)

comment:2 Changed 7 years ago by Julian Rüth

Keywords: days71 added

comment:3 Changed 5 years ago by David Roe

Keywords: sd87 added

comment:4 Changed 4 years ago by David Roe

Keywords: padicIMA added

comment:5 Changed 4 years ago by Xavier Caruso

some_elements() now returns more elements. Should we considerer that this issue is fixed?

comment:6 Changed 4 years ago by Julian Rüth

Authors: Julian Rüth
Milestone: sage-7.2sage-duplicate/invalid/wontfix
Reviewers: Julian Rüth
Status: newneeds_review

comment:7 Changed 4 years ago by Julian Rüth

Yes, good enough for the time being.

comment:8 Changed 4 years ago by Julian Rüth

Status: needs_reviewpositive_review

comment:9 Changed 4 years ago by Erik Bray

Resolution: worksforme
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.