VMS Help  —  FORTRAN  Intrinsic Procedures, SPREAD
  SPREAD (source, dim, ncopies)

  Class:  Transformational function - Generic

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

  The "source" can be an array or scalar.  The "dim" is a scalar of
  type integer.  It must have a value in the range 1 to n +
  1(inclusive), where "n" is the rank of "source".  The integer
  scalar "ncopies" becomes the extent of the added dimension in the
  result.

  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".

  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|
Close Help