XL Fortran for AIX 8.1

Language Reference

+-------------------------------IBM Extension--------------------------------+


CVMGx(TSOURCE, FSOURCE, MASK)

The conditional vector merge functions (CVMGM, CVMGN, CVMGP, CVMGT, and CVMGZ) enable you to port existing code that contains these functions.

Calling them is very similar to calling

MERGE ( TSOURCE, FSOURCE, arith_expr .op. 0 )
or
MERGE ( TSOURCE, FSOURCE, logical_expr .op. .TRUE. )

Because the MERGE intrinsic is part of the Fortran 90 language, we recommend that you use it instead of these functions for any new programs.

TSOURCE
is a scalar or array expression of type LOGICAL, INTEGER, or REAL and any kind except 1.

FSOURCE
is a scalar or array expression with the same type and type parameters as TSOURCE.

MASK
is a scalar or array expression of type INTEGER or REAL (for CVMGM, CVMGN, CVMGP, and CVMGZ) or LOGICAL (for CVMGT), and any kind except 1. If it is an array, it must conform in shape to TSOURCE and FSOURCE.

If only one of TSOURCE and FSOURCE is typeless, the typeless argument acquires the type of the other argument. If both TSOURCE and FSOURCE are typeless, both arguments acquire the type of MASK. If MASK is also typeless, both TSOURCE and FSOURCE are treated as default integers. If MASK is typeless, it is treated as a default logical for the CVMGT function and as a default integer for the other CVMGx functions.

Class

Elemental function

Result Type and Attributes

Same as TSOURCE and FSOURCE.

Result Value

The function result is the value of either the first argument or second argument, depending on the result of the test performed on the third argument. If the arguments are arrays, the test is performed for each element of the MASK array, and the result may contain some elements from TSOURCE and some elements from FSOURCE.

Table 15. Result Values for CVMGx Intrinsic Procedures

Explanation Function Return Value Generic Name
Test for positive or zero TSOURCE if MASK>=0 FSOURCE if MASK<0 CVMGP
Test for negative TSOURCE if MASK<0 FSOURCE if MASK>=0 CVMGM
Test for zero TSOURCE if MASK=0 FSOURCE if MASK<>0 CVMGZ
Test for nonzero TSOURCE if MASK<>0 FSOURCE if MASK=0 CVMGN
Test for true TSOURCE if MASK= .true. FSOURCE if MASK= .false. CVMGT

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]