HELPLIB.HLB  —  FORTRAN  Intrinsic Procedures, UNPACK
  UNPACK (vector, mask, field)

  Class:  Transformational function - Generic

  Takes elements from a rank-one array and unpacks them into another
  (possibly larger) array under the control of a mask.

  The "vector" must be a rank-one array of any type.  Its size must
  be at least t, where "t" is the number of true elements in "mask".
  The "mask" must be of logical type; it determines where elements of
  "vector" are placed when they are unpacked.

  The "field" must be of the same type and type parameters as
  "vector" and conformable with "mask".  Elements in "field" are
  inserted into the result array when the corresponding "mask"
  element has the value false.

  The result is an array with the same shape as "mask", and the same
  type and type parameters as "vector".

  Elements in the result array are filled in array element order.  If
  element i of the result is true, the corresponding element of the
  result is filled by the next element in "vector".

  Examples:

  Consider that N is the array |0 0 1|, P is the array (2, 3, 4, 5),
                               |1 0 1|
                               |1 0 0|

  and Q is the array |T F F|
                     |F T F|.
                     |T T F|

  UNPACK (P, MASK=Q, FIELD=N) produces the result

   |2 0 1|
   |1 4 1|.
   |3 5 0|

  UNPACK (P, MASK=Q, FIELD=1) produces the result

   |2 1 1|
   |1 4 1|.
   |3 5 1|
Close Help