![]() | This article is rated Start-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||
|
The article says the number of circular shifts of a set of size n is (n − 1)!. Using circular shifts in the sense used in the example, I think the number of circular shifts of a set of size n is n. Ray Spalding 01:31, 29 May 2006 (UTC)
If we have N elements in set(register,variable,etc) e.g. 1 2 3 4 5 6 7 left 2 3 4 5 6 7 1, 3 4 5 6 7 1 2, 4 5 6 7 1 2 3, 5 6 7 1 2 3 4,6 7 1 2 3 4 5,7 1 2 3 4 5 6 and right 7 1 2 3 4 5 6, 6 7 1 2 3 4 5,5 6 7 1 2 3 4, 4 5 6 7 1 2 3,3 4 5 6 7 1 2,2 3 4 5 6 7 1 Its clearly seen that Nth rotation to either side(rotation are equivalent) will become the same set. So the number of possible rotations is n-1
—The preceding unsigned comment was added by 84.228.240.173 ( talk) 10:41, 11 March 2007 (UTC).
Took me awhile to figure out an efficient implementation of this , but you can implement it by ORing x left shifts and (n - x) right shifts. n is the size of your bit pattern. -- Voidvector ( talk) 04:47, 10 October 2008 (UTC)
The implementation has a potential bug. When shift == 0, the right half becomes x << 32, which is undefined in C (shift must be strictly less than the width of the word - see section 5.8 in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf). If you're on a IA-32 processor, shifts effectively mask against 31 on the right operand, so x << 32 becomes x << 0, which |'s with x >> 0 to give the right result, but an alternate implementation (say, clamp to [0,31]) might fail. 76.202.198.141 ( talk) 07:09, 21 January 2009 (UTC)
Behaviour of right-shift is also undefined in C. May propagate bit 31 right. —Preceding unsigned comment added by 212.44.19.206 ( talk) 10:57, 3 March 2009 (UTC)
The article on this page refers to the same mathematical concept as Definition 1 in the article on cyclic permutation. It seems to me that usage of the term cyclic shift predominates in computer science (including theoretical computer science), whereas the term cyclic permutation is preferred by pure mathematicians (in particular algebraists). Therefore I suggest to merge the two articles. Hermel ( talk) 13:26, 31 December 2009 (UTC)
Either text should be added to the article explaining how the diagram relates to circular shifts, or the diagram should be replaced with something that clearly illustrates circular shifts. It is unclear, for example, how the sequence "A051683 Triangle read by rows: a(n,k)=n!*k." is relevant, let alone the rest of the diagram. -- 24.47.169.50 ( talk) 16:46, 26 April 2015 (UTC)
![]() | This article is rated Start-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||
|
The article says the number of circular shifts of a set of size n is (n − 1)!. Using circular shifts in the sense used in the example, I think the number of circular shifts of a set of size n is n. Ray Spalding 01:31, 29 May 2006 (UTC)
If we have N elements in set(register,variable,etc) e.g. 1 2 3 4 5 6 7 left 2 3 4 5 6 7 1, 3 4 5 6 7 1 2, 4 5 6 7 1 2 3, 5 6 7 1 2 3 4,6 7 1 2 3 4 5,7 1 2 3 4 5 6 and right 7 1 2 3 4 5 6, 6 7 1 2 3 4 5,5 6 7 1 2 3 4, 4 5 6 7 1 2 3,3 4 5 6 7 1 2,2 3 4 5 6 7 1 Its clearly seen that Nth rotation to either side(rotation are equivalent) will become the same set. So the number of possible rotations is n-1
—The preceding unsigned comment was added by 84.228.240.173 ( talk) 10:41, 11 March 2007 (UTC).
Took me awhile to figure out an efficient implementation of this , but you can implement it by ORing x left shifts and (n - x) right shifts. n is the size of your bit pattern. -- Voidvector ( talk) 04:47, 10 October 2008 (UTC)
The implementation has a potential bug. When shift == 0, the right half becomes x << 32, which is undefined in C (shift must be strictly less than the width of the word - see section 5.8 in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf). If you're on a IA-32 processor, shifts effectively mask against 31 on the right operand, so x << 32 becomes x << 0, which |'s with x >> 0 to give the right result, but an alternate implementation (say, clamp to [0,31]) might fail. 76.202.198.141 ( talk) 07:09, 21 January 2009 (UTC)
Behaviour of right-shift is also undefined in C. May propagate bit 31 right. —Preceding unsigned comment added by 212.44.19.206 ( talk) 10:57, 3 March 2009 (UTC)
The article on this page refers to the same mathematical concept as Definition 1 in the article on cyclic permutation. It seems to me that usage of the term cyclic shift predominates in computer science (including theoretical computer science), whereas the term cyclic permutation is preferred by pure mathematicians (in particular algebraists). Therefore I suggest to merge the two articles. Hermel ( talk) 13:26, 31 December 2009 (UTC)
Either text should be added to the article explaining how the diagram relates to circular shifts, or the diagram should be replaced with something that clearly illustrates circular shifts. It is unclear, for example, how the sequence "A051683 Triangle read by rows: a(n,k)=n!*k." is relevant, let alone the rest of the diagram. -- 24.47.169.50 ( talk) 16:46, 26 April 2015 (UTC)