#12418: adding Delsarte bound for codes
---------------------------------+------------------------------------------
       Reporter:  dimpase        |         Owner:  wdj         
           Type:  enhancement    |        Status:  needs_review
       Priority:  major          |     Milestone:  sage-5.4    
      Component:  coding theory  |    Resolution:              
       Keywords:                 |   Work issues:              
Report Upstream:  N/A            |     Reviewers:              
        Authors:                 |     Merged in:              
   Dependencies:  #12533         |      Stopgaps:              
---------------------------------+------------------------------------------

Comment (by ppurka):

 I think the `Krawtchouk` polynomial could be computed explicitly by not
 making repeated calls to `binomial`. This should speed it up. I have
 something like this in mind:
 {{{
 def Krawtchouk2(n,q,l,i):
     # Use the expression in equation (55) of MacWilliams & Sloane, pg 151
     # We write jth term = some_factor * (j-1)th term
     kraw = jth_term = (q-1)**l * binomial(n, l) # j=0
     for j in range(1,l+1):
         jth_term *= -q*(l-j+1)*(i-j+1)/((q-1)*j*(n-j+1))
         kraw += jth_term
     return kraw

 n,q,l,i = 10,8,7,5
 timeit('Krawtchouk2(n,q,l,i)')
 timeit('Krawtchouk (n,q,l,i)')
 print Krawtchouk2(n,q,l,i) == Krawtchouk(n,q,l,i)

 625 loops, best of 3: 53.3 µs per loop
 625 loops, best of 3: 205 µs per loop
 True
 }}}

 I noticed that sage handles nonintegral components in the binomial, so the
 expression for the `Krawtchouk` already works with nonintegral `n` and
 `x`.
 {{{
 n,q,l,i = 10.6,8,7,5.4
 #timeit('Krawtchouk3(n,q,l,i)')
 timeit('Krawtchouk2(n,q,l,i)')
 timeit('Krawtchouk (n,q,l,i)')
 print Krawtchouk2(n,q,l,i) == Krawtchouk(n,q,l,i)
 print Krawtchouk2(n,q,l,i), Krawtchouk(n,q,l,i)

 625 loops, best of 3: 382 µs per loop
 125 loops, best of 3: 4.74 ms per loop
 False
 93582.0160001147 93582.0159999999
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12418#comment:12>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to