\"\" \"\" \"\"
Go backward to Loop Distribution
Go up to Top
Go forward to Conditional Vector Merge
RISC-Linz logo

Vectorization of Conditionals

Merge different vectors.
DO I = 1, N
  IF (A(I).GT.0)
    A(I) = A(I)+B(I)
  ELSE
    A(I) = A(I)-B(I)
  ENDIF
ENDDO
|
V
M(1:N) = A(1:N).GT.0
A(1:N) = CMERGE(M, A+B, A-B)
Both branches are computed for all elements!
Author: Wolfgang Schreiner
Last modification: November 15, 1996