merge(3I)

MERGE - Chooses an alternative value according to the value of a mask

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

NAME
     MERGE - Chooses an alternative value according to the value of a mask

SYNOPSIS
     MERGE ([TSOURCE=]tsource, [FSOURCE=]fsource, [MASK=]mask)

IMPLEMENTATION
     UNICOS, UNICOS/mk, IRIX systems

     CF90, MIPSpro 7 Fortran 90

STANDARDS
     Fortran

DESCRIPTION
     The MERGE intrinsic function can be used for array construction.  It
     chooses an alternative value according to the value of mask.  This
     function accepts the following arguments:

     tsource   May be of any type

     fsource   Must be of the same type and type parameters as tsource

     mask      Must be of type logical

     MERGE is an elemental function.  The name of this intrinsic cannot be
     passed as an argument.

RETURN VALUES
     The result has the same type and type parameters as tsource.  The
     result is tsource if mask is true and fsource otherwise.

EXAMPLES
     Example 1:  Assume that tsource, fsource, and mask are arrays.  Array
     tsource is as follows:

        | 1 6 5 |

        | 2 4 6 |

     Array fsource is as follows:

        | 0 3 2 |

        | 7 4 8 |

     Array mask is as follows:

        | T F T |

        | F F T |

     Also assume that the letter T represents the value true and the letter
     F represents the value false.  The statement MERGE(tsource, fsource,
     mask) generates the following:

        | 1 3 5 |

        | 7 4 6 |

     Example 2:  The value of MERGE(1.0,0,0,k>0) is [1.0] for k = 5.

     Example 3:  The value of MERGE(1.0,0,0,k>0) is [0.0] for k = -2.

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