next up previous contents
Next: SPREAD Intrinsic Up: Array Construction Intrinsics Previous: Array Construction Intrinsics

 

MERGE Intrinsic

MERGE(TSOURCE,FSOURCE,MASK)

This function merges two arrays under mask control. TSOURCE, FSOURCE and MASK must all conform and the result is TSOURCE where MASK is .TRUE. and FSOURCE where it is .FALSE..

Consider,

    INTEGER, DIMENSION(2,3) :: TSOURCE, FSOURCE
    LOGICAL, DIMENSION(2,3) :: MASK
    LOGICAL, PARAMETER :: T = .TRUE.
    LOGICAL, PARAMETER :: F = .FALSE.
    TSOURCE = RESHAPE((/1,3,5,7,9,11/), (/2,3/))
    FSOURCE = RESHAPE((/0,2,4,6,8,10/), (/2,3/))
    MASK    = RESHAPE((/T,F,T,F,F,T/), (/2,3/))

Now, as

displaymath28760

the highlighted elements are selected from the two source arrays,

displaymath28775

and

displaymath28776

thus

displaymath28777

Return to corresponding overview page gif


next up previous contents
Next: SPREAD Intrinsic Up: Array Construction Intrinsics Previous: Array Construction Intrinsics

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.