Prev Next

@(@\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}@)@
Conditional Expressions

Syntax
result = condexp_rel(leftrightif_trueif_false)

Purpose
Record, as part of an operation sequence, the conditional result
     if( 
left op right )
          
result = if_true
     else 
result = if_false
The relation rel% , and operator op , have the following correspondence:
     
rel   lt   le   eq   ge   gt
      
op    <   <=   ==    >   >=

rel
In the syntax above, the relation rel represents one of the following two characters: lt, le, eq, ge, gt. As in the table above, rel determines which comparison operator op is used when comparing left and right .

left
The argument left must have type a_float or a2float. It specifies the value for the left side of the comparison operator.

right
The argument right must have the same type as left . It specifies the value for the right side of the comparison operator.

if_true
The argument if_true must have the same type as left . It specifies the return value if the result of the comparison is true.

if_false
The argument if_false must have the same type as left . It specifies the return value if the result of the comparison is false.

result
This result has the same type as left .

Example
The file condexp.py contains an example and test of these functions.
Input File: pycppad/pycppad.cpp