CSHIFT — Circular shift elements of an array#
- 
CSHIFT(ARRAY, SHIFT, DIM)#
- CSHIFT(ARRAY, SHIFT [, DIM])performs a circular shift on elements of- ARRAYalong the dimension of- DIM. If- DIMis omitted it is taken to be- 1.- DIMis a scalar of type- INTEGERin the range of 1 leq DIM leq n) where n is the rank of- ARRAY. If the rank of- ARRAYis one, then all elements of- ARRAYare shifted by- SHIFTplaces. If rank is greater than one, then all complete rank one sections of- ARRAYalong the given dimension are shifted. Elements shifted out one end of each rank one section are shifted back in the other end.- Parameters
- ARRAY – Shall be an array of any type. 
- SHIFT – The type shall be - INTEGER.
- DIM – The type shall be - INTEGER.
 
- Returns
- Returns an array of same type and rank as the - ARRAYargument.
 - Standard:
- Fortran 90 and later 
- Class:
- Transformational function 
- Syntax:
- RESULT = CSHIFT(ARRAY, SHIFT [, DIM]) 
- Example:
- program test_cshift integer, dimension(3,3) :: a a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /)) print '(3i3)', a(1,:) print '(3i3)', a(2,:) print '(3i3)', a(3,:) a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2) print * print '(3i3)', a(1,:) print '(3i3)', a(2,:) print '(3i3)', a(3,:) end program test_cshift