RobinHankin / permutations

https://robinhankin.github.io/permutations/
5 stars 3 forks source link

sgn() bug #12

Closed RobinHankin closed 5 years ago

RobinHankin commented 5 years ago

If given a single permutation, sgn() should return either +1 or -1, depending on the sign of the permutation. But, sometimes it returns more than one number:

> w <- word(rbind(c(3,4,1,2)))
> w
[1] (13)(24)
> sgn(word(rbind(c(3,4,1,2))))
[1] -1 -1
> 

Here, permutation w is a product of two transpositions, each with a sign of -1 so I would expect a sign of (-1)*(-1)=+1. But, we get a sign of each transposition separately.

RobinHankin commented 5 years ago

identical to #4 (which was fixed). Not sure why I was using an old version of the package. Fixed in 98528c5.