#20239: Make p-adic some_elements() non-trivial
-------------------------------+------------------------
       Reporter:  saraedum     |        Owner:
           Type:  enhancement  |       Status:  new
       Priority:  minor        |    Milestone:  sage-7.2
      Component:  padics       |   Resolution:
       Keywords:               |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+------------------------
Description changed by saraedum:

Old description:

> `some_elements()` currently returns 0, 1, p. This makes most of our
> automated tests trivial.

New description:

 `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(self.prime())
         pi = self.uniformizer()
         e = self.ramification_index()

         yield self.zero()
         yield self.one()
         yield -self.one()
         yield p
         yield pi

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

         yield self.zero().add_bigoh(0)
         yield self.zero().add_bigoh(self.precision_cap()-1)
         if self.is_field():
             yield self.zero().add_bigoh(-2)

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


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

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

         EXAMPLES::

             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.)

--

--
Ticket URL: <http://trac.sagemath.org/ticket/20239#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to