is_cycle?

07192018, 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 

07192018, 04:36 PM
(This post was last modified: 07192018 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)).


07192018, 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.


« Next Oldest  Next Newest »

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