*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> f90/cshift (3)              
Title
Content
Arch
Section
 

Contents


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

NAME    [Toc]    [Back]

     CSHIFT - Performs a circular shift	on an array expression

SYNOPSIS    [Toc]    [Back]

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

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     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    [Toc]    [Back]

     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    [Toc]    [Back]

     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    [Toc]    [Back]

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

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

NAME    [Toc]    [Back]

     CSHIFT - Performs a circular shift	on an array expression

SYNOPSIS    [Toc]    [Back]

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

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     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    [Toc]    [Back]

     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    [Toc]    [Back]

     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    [Toc]    [Back]

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

[ Back ]
 Similar pages
Name OS Title
eoshift IRIX Performs an end-off shift on an array expression
shift IRIX Performs a left circular shift
shifta IRIX Performs an arithmetic shift
shiftr IRIX Performs a right shift with zero fill
shiftl IRIX Performs a left shift with zero fill
dshiftr IRIX Performs a double-object right shift
dshiftl IRIX Performs a double-object left shift
sem_wait Tru64 Performs (or conditionally performs) a semaphore lock (P1003.1b)
sem_trywait Tru64 Performs (or conditionally performs) a semaphore lock (P1003.1b)
mbsinit Linux test for initial shift state
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service