Description: |
Creates a replicated array with an added dimension by making copies of existing elements along a specified dimension. | ||

Class: |
Transformational function; Generic | ||

Arguments: |
SOURCE | Must be a scalar or array (of any data type). The rank must be less than 7. | |

DIM | Must
be scalar and of type integer. It must have a value in the
range 1 to n + 1 (inclusive), where n is the rank of
SOURCE. | ||

NCOPIES | Must be scalar and of type integer. It becomes the extent of the additional dimension in the result. | ||

Results: |
The result is an array of the same type
as SOURCE and of rank that is one greater than SOURCE.
If SOURCE is an array, each array element in dimension DIM of the result is equal to the corresponding array element in SOURCE. If SOURCE is a scalar, the result is a rank-one array with NCOPIES elements, each with the value SOURCE. If NCOPIES <= zero, the result is an array of size zero. |

**Examples**

SPREAD ("B", 1, 4) is the character array (/"B", "B", "B", "B"/).

B is the array (3, 4, 5) and NC has the value 4.

SPREAD (B, DIM=1, NCOPIES=NC) produces the array

[ 3 4 5 ] [ 3 4 5 ] [ 3 4 5 ] [ 3 4 5 ].

SPREAD (B, DIM=2, NCOPIES=NC) produces the array

[3 3 3 3 ] [4 4 4 4 ] [5 5 5 5 ].

Previous Page Next Page Table of Contents