Shifts the elements of all vectors along a given dimension of an array. The shift is circular; that is, elements shifted off one end are inserted again at the other end.

**ARRAY**- is an array of any type.
**SHIFT**- must be a scalar integer if ARRAY has a rank of one; otherwise, it is a scalar integer or an integer expression of rank rank(ARRAY)-1.
**DIM (optional)**- is an integer scalar in the range 1 <= DIM <= rank(ARRAY). If absent, it defaults to 1.

**Class**

Transformational function

**Result Value**

The result is an array with the same shape and the same data type as ARRAY.

If SHIFT is a scalar, the same shift is applied to each vector.
Otherwise, each vector ARRAY (s_{1}, s_{2}, ...,
s_{(DIM-1)}, :, s_{(DIM+1)}, ..., s_{n}) is
shifted according to the corresponding value in SHIFT (s_{1},
s_{2}, ..., s_{(DIM-1)}, s_{(DIM+1)}, ...,
s_{n})

The absolute value of SHIFT determines the amount of shift. The sign of SHIFT determines the direction of the shift:

**Positive SHIFT**- moves each element of the vector toward the beginning of the vector.
**Negative SHIFT**- moves each element of the vector toward the end of the vector.
**Zero SHIFT**- does no shifting. The value of the vector remains unchanged.

**Examples**

```
! A is the array | A D G |
! | B E H |
! | C F I |
! Shift the first column down one, the second column
! up one, and leave the third column unchanged.
RES = CSHIFT (A, SHIFT = (/-1,1,0/), DIM = 1)
! The result is | C E G |
! | A F H |
! | B D I |
! Do the same shifts as before, but on the rows
! instead of the columns.
RES = CSHIFT (A, SHIFT = (/-1,1,0/), DIM = 2)
! The result is | G A D |
! | E H B |
! | C F I |
```