a_double_cond_assign#

View page source

AD Conditional Assignment#

Syntax#

target.cond_assign ( cop , left , right , if_true , if_false )

Purpose#

The code

      if ( left cop right )
            target = if_true
      else
            target = if_false

records either the true or false case depending on the value of left and right ; see cpp_fun_ctor. If left or right is a variable, it may be desirable to switch between if_true and if_false depending of the value of the independent variable during calls to order zero cpp_fun_forward. The cond_assign does this.

target#

This object has c++ prototype

      a_double& target

cop#

This argument has c++ prototype

      const char *cop

The comparison is

      left cop right

where cop is one of the following:

cop

<

less than

<=

less than or equal

==

equal

>=

greater than or equal

>

greater than

left#

This argument has c++ prototype

      const a_double& left

It specifies the left operand in the comparison.

if_true#

This argument has c++ prototype

      const a_double& if_true

It specifies the value assigned to ad if the result of the comparison is true.

if_false#

This argument has c++ prototype

      const a_double& if_false

It specifies the value assigned to ad if the result of the comparison is false.

Example#

c++, python.