On Tue, Nov 19, 2013 at 9:46 AM, Peter Mueller <ypf...@googlemail.com> wrote:
> Dear Sage Developers,
>
> the Elias bound of coding theory is wrongly implemented. Compare
>

Thanks for this report.

Would you mind creating a trac ticket for this?
I'd be very grateful.

> sage: elias_upper_bound(10,2,8,algorithm="gap"), elias_upper_bound(10,2,8)
> (4, 120)
>
> Looking at the relevant piece of code
>
>     else:
>         def ff(n,d,w,q):
>             return r*n*d*q**n/((w**2-2*r*n*w+r*n*d)*volume_hamming(n,q,w));
>     def get_list(n,d,q):
>         I = []
>         for i in range(1,int(r*n)+1):
>             if i**2-2*r*n*i+r*n*d>0:
>                 I.append(i)
>             return I
>     I = get_list(n,d,q)
>     bnd = min([ff(n,d,w,q) for w in I])
>     return int(bnd)
>
> reveals the mistake: The `return I' is one tab too deep, it has to get
> executed after the for loop is finished.
>
> One other note, which also refers to the otherwise correct algorithm="gap"
> version: Something like elias_upper_bound(10,2,1) yields an error because
> for these parameters the Elias bound is not defined. Wouldn't it be better
> to return some trivial but true result in this case, like q^n?
>
> Yet another question: Does the above example, where two functions get
> defined but each of them gets used only at one place, follow certain coding
> conventions? As a work around, I implemented the Elias bound as
>
>     t = n*(1-1/q)
>     lr = [(r,r^2-2*t*r+t*d) for r in [1..floor(t)]]
>     lv = [t*d*q^n/z/volume_hamming(n,q,r) for (r,z) in lr if z > 0]
>     return q^n if len(lv) == 0 else floor(min(lv))
>
> which looks cleaner to me.
>
> Best wishes,
> Peter M.
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to