#18269: A new structure for experimentation on decoding: communication channels
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  dlucas                 |       Status:  needs_info
           Type:         |    Milestone:  sage-6.7
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  coding theory          |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  5f31c5cef52b9b0bdbd905f4ff132e344446e766
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/dlucas/channels      |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by vdelecroix):

 Replying to [comment:7 dlucas]:
 > I did some changes, as stated by commit messages above.
 >
 > Some remarks:
 >
 > - I kept `tuple_to_integer` because the user can pass either an integer
 or an
 > interval as `number_errors` parameter for the channels. If the user
 passes an
 > integer, then `randint` won't work. Of course it is possible to do the
 check
 > anytime you call `number_errors` (if integer, return it, else do a
 randint
 > and return the result) but it's rather tedious. Especially because it's
 > something that will be used by a some channels. I think it's easier to
 call a
 > single method rather than copying the `if` statement each time. Maybe
 > `tuple_to_integer` is not really a good name though.

 The name is very bad. Moreover you can convert an integer `a` into the
 tuple `(a,a)` in the constructor. With your way of doing it you avoid the
 function call to `randint` but with your version you always add an extra
 function call to `tuple_to_integer`.

 You should replace all occurrence of `hasattr(X, '__iter__')` by
 `isinstance(X, (tuple, list))`. Having an `__iter__` method does not
 charaterize tuples.

 > - `random_error_vector(n, F, error_positions)` returns a vector of
 length `n`
 > over `F` with `0`s in every position except those listed in
 > `error_positions`. Because of this, calling `vect = [F.random_element()
 for _
 > in range(n)]` in `random_error_vector` does not really fit, because it
 will
 > create a vector with non-controlled zero positions, so we'll need to set
 all
 > positions except those into `error_positions` afterwards. I think create
 a
 > zero vector of size `n` and add random values at some positions is
 better.

 Yes. You are right!

 > - I did not change the documentation, nor the catalog stuff (see comment
 4).
 > If you think that Channels are actually more linked to codes than to
 anything
 > else, I can make some changes

 You should tell me ;-) Cryptogtaphers might like it but they do use
 strings
 not vectors in a vector space over a finite field.

 12. When you do `__call__ = transmit` the documentation is copied as well.
 Did you try
 {{{
 sage: Chan = channels.StaticErrorRateChannel(GF(11), 2)
 sage: Chan.__call__?
 }}}

 13. I would rather implement `StaticErrorRateChannel.transmit_unsafe` as
 {{{
 def transmit_unsafe(self, msg):
     w = msg.copy()
     V = self.input_space()
     for i in sample_range(V.dim(), randint(*self.nb_errors())):
         w[i] = V.random_element()
     return w
 }}}
   it would be more direct. Moreover it shows that `sample_range` would
 better be an iterator instead of returning a list. By the way, this
 function `sample_range` has currently linear complexity in `n`, isn't it
 possible to make it linear in `k`?

 14. In the main documentation class, it is useful to document the main
 methods. In other words, when reading {{{sage:
 channels.StaticErrorChannel?}}} I should be able to discvoer the method
 `transmit` (and its alias usage with `__call__`).

 15. In the very top documentation, you can have links by writing
 {{{class:`AbstractChannel`}}} instead of {{{*AbstractChannel*}}}.

 Vincent

--
Ticket URL: <http://trac.sagemath.org/ticket/18269#comment:10>
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