rotate(): Rotating Collection Elements
rotate() cyclically moves entries in an array or matrix dimension. It is useful for circular buffers, periodic patterns, and shifting a sequence without losing elements.
Wraparound behavior
A positive or negative offset determines direction, while entries that leave one end reappear at the other. This differs from resize(), which can discard or add positions. Check the shape with size() and choose the intended dimension explicitly.
For one directional shift, compare results with leftShift() only conceptually: bit shifts alter binary digits, whereas rotate rearranges collection values. Use row() or column() to inspect matrix slices.