Post Reply 
is_cycle?
07-19-2018, 01:32 PM
Post: #1
is_cycle?
Does anyone know how this function is supposed to work? it is one of the CAS functions introduced in the latest update. The release notes do not explain it and Help just says it tests whether a permutation is a cycle. The functions cycle2perm and permu2cycles work as described here but is_cycle seems to return 1 for any permutation whether cyclic or not.

TIA,
John
Find all posts by this user
Quote this message in a reply
07-19-2018, 04:36 PM (This post was last modified: 07-19-2018 05:46 PM by parisse.)
Post: #2
RE: is_cycle?
is_cycle returns 0 if the list contains a negative value or if a value is not unique (by the way, I just realize that the algorithm for checking that should be improved, it is currently in O(n^2)).
Find all posts by this user
Quote this message in a reply
07-19-2018, 09:10 PM
Post: #3
RE: is_cycle?
I see. I was hoping it could test whether a given permutation was cyclic or not, but I realized that I could just check the size of the list returned by permu2cycles.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)