#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:
  coding theory          |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  5f31c5cef52b9b0bdbd905f4ff132e344446e766
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/dlucas/channels      |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by vdelecroix):

 Replying to [comment:12 vdelecroix]:
 > > 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`?
 >
 > Yes it is (the solution is not exactly linear though)
 > ...
 > It is roughly the same speed for `n=100` but for `n=1000` yours is twice
 slower.

 This code for subsets is just using
 {{{
 sage: sample(range(n), k)
 }}}
 So I guess this is currently the best way to do it. And moreover, looking
 at Python doc
 {{{
     To choose a sample in a range of integers, use xrange as an argument.
     This is especially fast and space efficient for sampling from a
     large population:   sample(xrange(10000000), 60)
 }}}
 Sorry for my previous remarks. You should just get rid of
 `sample_range(n,k)` and use `sample(xrange(n),k)`.

 Vincent

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