CSHIFT

Platform

x64, Win32, .NET

Purpose

Perform a circular shift on an array expression.

Class

Transformational function.

Syntax

FUNCTION CSHIFT(ARRAY, SHIFT [, DIM])
INTEGER SHIFT
INTEGER DIM

Description

Perform a circular shift on an array expression of rank one or perform circular shifts on all the complete rank one sections along a given dimension of an array expression of rank two or greater. Elements shifted out at one end of a section are shifted in at the other end. Different sections may be shifted by different amounts and in different directions.

DIM is optional and is a value in the range 1 < DIM < n where n is the rank (i.e. the number of dimensions) of ARRAY. The default value of DIM is 1.

Return value

The result has the same type, type parameters and shape as ARRAY.

Example

If A = [1, 2, 3, 4, 5] then CSHIFT(A, 2) (i.e. shifted to the left) gives [3, 4, 5, 1, 2], and CSHIFT(A, -2) gives [4, 5, 1, 2, 3].

If B = then CSHIFT(B, 1, 2) gives

If SHIFT = [1, 0, 2] then CSHIFT(B, SHIFT, 2) gives .

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited