unpack(3I)

UNPACK - Unpacks an array of rank one into an array under control of a mask

As shipped in IRIX 6.5.7. Last changed in IRIX 6.5.5.

NAME
     UNPACK - Unpacks an array of rank one into an array under control of a
     mask

SYNOPSIS
     UNPACK ([VECTOR=]vector, [MASK=]mask, [FIELD=]field)

IMPLEMENTATION
     UNICOS, UNICOS/mk, IRIX systems

     CF90, MIPSpro 7 Fortran 90

STANDARDS
     Fortran

DESCRIPTION
     The UNPACK intrinsic function unpacks an array of rank one into an
     array under control of mask.  It accepts the following arguments:

     vector    Can be of any type.  It must have rank one.  Its size must
               be at least t where t is the number of true elements in
               mask.

     mask      Must be of type logical and array valued.

     field     Must be of the same type as vector, and must be conformable
               with mask.

     UNPACK is a transformational function.  The name of this intrinsic
     cannot be passed as an argument.

RETURN VALUES
     The result is an array of the same type as vector and the same shape
     as mask.

     The element of the result that corresponds to the ith true element of
     mask, in array element order, has the value vector(i) for i=1, 2, ...,
     t where t is the number of true values in mask.  Each other element
     has the value equal to field if field is scalar or to the
     corresponding element of field if it is an array.

EXAMPLES
     This example uses UNPACK to scatter specific values to specific
     positions in an array.

     Assume that M is the following array:

          | 1 0 0 |
          | 0 1 0 |
          | 0 0 1 |

     Assume that V is the array [1, 2, 3].

     Assume that Q is the logical mask:

          | F T F |
          | T F F |
          | F F T |

     In logical mask Q, T represents true and F represents false, so
     UNPACK(V, MASK=Q, FIELD=M) has the following value:

          | 1 2 0 |
          | 1 1 0 |
          | 0 0 3 |

     The result of UNPACK(V, MASK=Q, FIELD=0) has the following value:

          | 0 2 0 |
          | 1 0 0 |
          | 0 0 3 |

SEE ALSO
     Intrinsic Procedures Reference Manual for the printed version of this
     man page.