[sage-combinat-devel] Re: Robinson-Schensted bug

2013-01-21 Thread Jean-Yves Thibon
Located the error: in permutation.py,  lines 3758 and 3766,
bisect should be replaced by bisect_left, as follows:

from bisect import bisect_left

permutation = []
d = dict((qij,i) for i,Li in enumerate(q) for qij in Li)
p = map(list, p)
for i in reversed(d.values()):
x = p[i].pop()
for row in reversed(p[:i]):
y = bisect_left(row,x) - 1
x, row[y] = row[y], x
permutation.append(x)
return Permutation(reversed(permutation))






Le lundi 21 janvier 2013 08:23:57 UTC+1, Jean-Yves Thibon a écrit :
>
> robinson_schensted_inverse returns wrong output:
>
>
> from sage.combinat.permutation import robinson_schensted_inverse
> sage: u
> [[1, 1, 1], [2, 2], [3]]
> sage: t
> [[1, 3, 4], [2, 6], [5]]
> sage: w = robinson_schensted_inverse(u,t)
> sage: w
> [3, 1, 1, 2, 2, 1]
> sage: w.robinson_schensted()
> [[[1, 1, 1, 2], [2], [3]], [[1, 3, 4, 5], [2], [6]]]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/54Kii19Cd9AJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Robinson-Schensted bug

2013-01-21 Thread Travis Scrimshaw
Hey Jean-Yves,
   If you want to write a small patch to fix this to get something merged 
into sage, please let me know because I might need to rebase 
trac_8392-check_permutation-ts.patch (I can also review it). Otherwise I 
can work the fix in my aforementioned patch because I'm reworking the RSK 
interface (turns out I've unintentionally had the fix for this, although 
it's not yet in Permutation_class.robinson_schensted() :-P ).

Thanks,
Travis


On Monday, January 21, 2013 10:14:32 AM UTC-8, Jean-Yves Thibon wrote:
>
> Located the error: in permutation.py,  lines 3758 and 3766,
> bisect should be replaced by bisect_left, as follows:
>
> from bisect import bisect_left
>
> permutation = []
> d = dict((qij,i) for i,Li in enumerate(q) for qij in Li)
> p = map(list, p)
> for i in reversed(d.values()):
> x = p[i].pop()
> for row in reversed(p[:i]):
> y = bisect_left(row,x) - 1
> x, row[y] = row[y], x
> permutation.append(x)
> return Permutation(reversed(permutation))
>
>
>
>
>
>
> Le lundi 21 janvier 2013 08:23:57 UTC+1, Jean-Yves Thibon a écrit :
>>
>> robinson_schensted_inverse returns wrong output:
>>
>>
>> from sage.combinat.permutation import robinson_schensted_inverse
>> sage: u
>> [[1, 1, 1], [2, 2], [3]]
>> sage: t
>> [[1, 3, 4], [2, 6], [5]]
>> sage: w = robinson_schensted_inverse(u,t)
>> sage: w
>> [3, 1, 1, 2, 2, 1]
>> sage: w.robinson_schensted()
>> [[[1, 1, 1, 2], [2], [3]], [[1, 3, 4, 5], [2], [6]]]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/VkNIB8Vmxc4J.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Robinson-Schensted bug

2013-01-21 Thread Travis Scrimshaw

>
> (turns out I've unintentionally had the fix for this, although it's not 
> yet in Permutation_class.robinson_schensted() :-P ).


Scratch that last bit, this would be in the robinson_schensted_inverse().

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/nF6zodyBKKAJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Robinson-Schensted bug

2013-01-21 Thread Jean-Yves Thibon
Hi Travis,

if you can fix it, that's fine for me.

Thanks,
Jean-Yves

Le mardi 22 janvier 2013 04:15:16 UTC+1, Travis Scrimshaw a écrit :
>
> (turns out I've unintentionally had the fix for this, although it's not 
>> yet in Permutation_class.robinson_schensted() :-P ).
>
>
> Scratch that last bit, this would be in the robinson_schensted_inverse().
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/rg7TLmQwTlYJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.