In combinatorial mathematics, a circular shift is the operation of rearranging the entries in a tuple, either by moving the final entry to the first position, while shifting all other entries to the next position, or by performing the inverse operation. Thus, a circular shift is given by the action of a particular permutation σ of the n positions in the tuple, for which modulo n for all i (or modulo n for the inverse operation). This permutation is a (very particular) instance of an n-cycle.
The result of repeatedly applying circular shifts to a given tuple are also called the circular shifts of the tuple.
For example, repeatedly applying circular shifts to the four-tuple (a, b, a, c) successively gives
- (c, a, b, a),
- (a, c, a, b),
- (b, a, c, a),
- (a, b, a, c) (the original four-tuple),
and then the sequence repeats; this four-tuple therefore has four circular shifts. However the 4-tuple (a, b, a, b) only has 2 (distinct) circular shifts. In general the number of circular shifts of an n-tuple could be any divisor of n, depending on the entries of the tuple.
In computer programming, a circular shift (or bitwise rotation) is a shift operator that shifts all bits of its operand. Unlike an arithmetic shift, a circular shift does not preserve a number's sign bit or distinguish a number's exponent from its mantissa. Unlike a logical shift, the vacant bit positions are not filled in with zeros but are filled in with the bits that are shifted out of the sequence.
Read more about Circular Shift: Implementing Circular Shifts, Example, Applications
Famous quotes containing the words circular and/or shift:
“If one doubts whether Grecian valor and patriotism are not a fiction of the poets, he may go to Athens and see still upon the walls of the temple of Minerva the circular marks made by the shields taken from the enemy in the Persian war, which were suspended there. We have not far to seek for living and unquestionable evidence. The very dust takes shape and confirms some story which we had read.”
—Henry David Thoreau (18171862)
“The frantic search of five-year-olds for friends can thus be seen to forecast the beginnings of a basic shift in the parent-child relationship, a shift which will occur gradually over many long years, and in which a child needs not only the support of child allies engaged in the same struggle but also the understanding of his parents.”
—Dorothy H. Cohen (20th century)