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

displaymath23422

the highlighted elements are selected from the two source arrays,

displaymath23437

and

displaymath23438

thus

displaymath23439


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

Adam Marshall ©University of Liverpool, 1996
Tue Nov 26 17:50:42 GMT 1996