cshift man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]

CSHIFT(3I)					       Last changed: 1-6-98

NAME
     CSHIFT - Performs a circular shift on an array expression

SYNOPSIS
     CSHIFT ([ARRAY=]array, [SHIFT=]shift [, [DIM=]dim])

IMPLEMENTATION
     UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
     Fortran 90

DESCRIPTION
     The CSHIFT intrinsic function performs a circular shift on an array
     expression of rank 1 or performs circular shifts on all the complete
     rank 1 sections along a given array expression of rank 2 or greater.
     Elements shifted out at one end are shifted in at the other end.
     Different sections can be shifted by different amounts and in
     different directions; positive for left shifts, negative for right
     shifts.

     CSHIFT accepts the following arguments:

     array     Can be of any type.  It must not be a scalar.

     shift     Must be integer.	 If array has rank 1, shift must be a
	       scalar.	Otherwise, shift must be scalar or have rank n-1
	       and have
	       shape (d , d , ..., d	 , d	 , ..., d ),
		       1   2	    dim-1   dim+1	 n
	       where (d , d , ..., d )
		       1   2	    n
	       is the shape of array.

     dim       Must be a scalar.  It is an integer with a value in the
	       range 1 <= dim <= n, where n is the rank of array.  If dim
	       is omitted, a value of 1 is assumed.

     CSHIFT is a transformational function.  The name of this intrinsic
     cannot be passed as an argument.

RETURN VALUES
     The result is an array of the same type, type parameters, and shape as
     array.

     If array has rank 1, element i of the result is
     array(1 + modulo(i + shift - 1, size(array))).

     If array has rank greater than 1,
     section (s , s , ..., s	 , : , s     , ..., s )
	       1   2	    dim-1	dim+1	     n
     of the result has a value equal to
     CSHIFT(array (s , s , ..., s     , : , s	  , ..., s ), sh, 1),
		    1	2	 dim-1	     dim+1	  n
     where sh is shift or
     shift(s , s , ..., s     , s     , ..., s )
	    1	2	 dim-1	 dim+1	      n

EXAMPLES
     Example 1:	 If V is a rank 1 array [1, 2, 3, 4, 5, 6], the effect of
     shifting V circularly to the left by two positions is achieved by
     CSHIFT ( V, SHIFT = 2), which has the value [3, 4, 5, 6, 1, 2].
     Specifying CSHIFT ( V, SHIFT = -2 ) achieves a circular shift to the
     right by two positions and has the value [5, 6, 1, 2, 3, 4].

     Example 2:	 The rows of an array of rank 2 can all be shifted by the
     same amount or by different amounts.  Assume M is the following array:

	| 1 2 3 |

	| 4 5 6 |

	| 7 8 9 |

     The value of CSHIFT(M, SHIFT =-1, DIM = 2) is as follows:

	| 3 1 2 |

	| 6 4 5 |

	| 9 7 8 |

     The value of CSHIFT(M, SHIFT =(/ -1, 1, 0 /), DIM = 2) is as follows:

	| 3 1 2 |

	| 5 6 4 |

	| 7 8 9 |

     Example 3:	 N is the following array:

	| 1 2 3 4 |

	| 5 6 7 8 |

	| 9 10 11 12 |

     The value of CSHIFT(N, SHIFT =-1, DIM = 1) is as follows:

	| 9 10 11 12 |

	| 1 2 3 4 |

	| 5 6 7 8 |

     With an array section of multidimensional array N, the value of
     SHIFT(N(2:3,2:4), SHIFT=-1, DIM=1) is as follows:

	| 10 11 12 |

	| 6 7 8 |

SEE ALSO
     Intrinsic Procedures Reference Manual, publication SR-2138, for the
     printed version of this man page.

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net