#18269: A new structure for experimentation on decoding: communication channels
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  dlucas                 |       Status:  needs_work
           Type:         |    Milestone:  sage-6.7
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:  Vincent Delecroix
  coding theory          |  Work issues:
       Keywords:         |       Commit:
        Authors:  David  |  723a55c71861db896335aa75763e8bba85a2a3b0
  Lucas                  |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/dlucas/channels      |
   Dependencies:         |
-------------------------+-------------------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work


Comment:

 21. In each class/function/method the documentation should be:
  - one line description
  - then more details in one or several paragraphs if needed. It is not the
 case in `StaticErrorRateChannel` and `ErrorErasureChannel`.

   Moreover, in a class you should not write as a description `Construct a
 X`. It is rather simply `X`. The reason is because it is the documentation
 of the class itself that you will see with:
 {{{
 sage: Chan = channels.ErrorErasureChannel(GF(59)^40, 2, 2)
 sage: Chan?<enter>
 }}}
   (BTW there is a nice short cut to build vector spaces: `K^n` just
 works!)

 22. You can simplify a bit the `ErrorErasureChannel._repr_`. By doing
 things in two parts
 {{{
 def format_interval(t):
     return str(t[0]) if t[0] == t[1] else 'between %s and %s' %(t[0],
 t[1])

 def _repr_():
     return "Error-and-erasure channel creating %s errors and %s erasures'
 %(
               format_interval(self.number_errors()),
               format_interval(self.number_erasures()))
 }}}
   And if you really care about pluralization
 {{{
 def format_interval(t, singular, plural):
     name = singular if t[1] < 2 else plural
     if t[0] == t[1]:
         return '%s %s' %(t[0], name)
     else:
         return 'between %s and %s %s' %(t[0], t[1], name)
 }}}
   Such `format_interval` can be used in all your `_repr_` methods.

 23. You can simplify `ErrorErasureChannel.transmit_unsafe`. Notice that
 the output of `sample` is already randomized (you can have a look at the
 code source which is pure python) and it is specified in its documentation
 {{{
 The resulting list is in selection order so that
 all sub-slices will also be valid random samples
 }}}
  Hence, you can simply cut your errors into two parts as
 {{{
 errors = sample(xrange(n), number_errors + number_erasures)
 error_positions   = errors[:number_errors]
 erasure_positions = errors[number_errors:]
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18269#comment:23>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to