Prev | Next |
op_code
value that
is used to identify it for a particular
json_ad_graph
.
first_arg
, ... ,
last_arg
are the node indices for arguments to an operator.
{
"op_code": op_code,
"name": name,
"n_arg": 1
}
where
name
is a string
.
A corresponding
op_usage
has the form
[ op_code, arg ]
The possible values for the string
name
are listed
in the table below.
The corresponding result is the node value as a function of the argument value.
name
| result |
abs | absolute value |
acos | inverse cosine |
acosh | inverse hyperbolic cosine |
asin | inverse sine |
asinh | inverse hyperbolic sine |
atan | inverse tangent |
atanh | inverse hyperbolic sine |
cos | cosine |
cosh | hyperbolic cosine |
erf | error functions |
erfc | complementary error function |
exp | exponential |
expm1 | minus one plus the exponential |
log | logarithm |
log1p | log plus one |
neg | negative |
sign | sign function |
sin | sine |
sinh | hyperbolic sine |
sqrt | square root |
tan | tangent |
tanh | hyperbolic tangent |
{
"op_code": op_code,
"name": name,
"n_arg": 2
}
where
name
is a string
.
A corresponding
op_usage
has the form
[ op_code, first_arg, second_arg ]
The possible values for the string
name
are listed below:
{
"op_code": op_code,
"name": "sum"
}
A corresponding
op_usage
has the form
[ op_code, n_result, n_arg, [ first_arg, ..., last_arg ] ]
where
n_result
is always 1
.
This operation creates one node with value equal to
the sum of values corresponding to all of its argument nodes.
{
"op_code": op_code,
"name": "cexp_rel,
"n_arg": 4
}
where
rel
is eq
(equal),
le
(less than or equal), or
lt
(less than).
The first argument is left
,
the second is right
,
the third is if_true
,
the fourth is if_false
,
the result is given by
if( left cop right)
result = if_true;
else
result = if_false;
where the comparison
cop
is define by the cases below:
cop
is ==
cop
is <=
cop
is <
CondExpGt(left, right, if_true, if_false)
is equivalent to
CondExpLe(left, right, if_false, if_true)
Similar conversions can be used for all the possible
conditional expressions
.
{
"op_code": op_code,
"name": "comp_rel"
}
where
rel
is eq
(equal),
ne
(not equal),
le
(less than or equal), or
lt
(less than).
A corresponding
op_usage
has the form
[ op_code, n_result, n_arg, [ left, right ] ]
left cop right
The comparison
cop
is define by the cases below.
The Json graph corresponds to the comparison being true.
If, for a value of the independent parameters and variables,
the comparison is false,
the Json graph may no longer be valid.
For example, the Json graph may only contain the code for the true case below:
if( left cop right )
{ source code when result is true }
else
{ source code when result is false }
Including this operator enables CppAD to detect when the graph
may no longer be a valid representation of the intended function.
cop
is ==
cop
is <=
cop
is <
cop
is !=
left > right
is equivalent to the comparison result true for
right < left
.
The comparison result false for
left > right
is equivalent to the comparison result true for
left <= right
.
In a similar fashion, all the possible comparisons results
can be converted to a true result for one of the comparisons above.
{
"op_code": op_code,
"name": "discrete"
}
A corresponding op_usage has the form
[ op_code, name, n_result, n_arg, [ arg ] ]
name
is a
string
specifying the
name
of the discrete function that is called.
1
because a discrete function
creates one new node.
The result node value is the specified discrete function of the argument value.
1
because a discrete function has
one argument node.
n_result
nodes with values determined by
an evaluation of the an atomic_three
or atomic_four
function.
{
"op_code": op_code,
"name": "atom"
}
A corresponding
op_usage
has the form
[ op_code, name, n_result, n_arg,
[ first_arg, ..., last_arg ]
]
{
"op_code": op_code,
"name": "atom4"
}
A corresponding
op_usage
has the form
[ op_code, name, call_id, n_result, n_arg,
[ first_arg, ..., last_arg ]
]
name
is a
string
specifying the
name
of the atomic_three
function that is called.
first_arg
, ...,
last_arg
are the
arguments (independent variables) for the atomic function evaluation.
In the case where the atomic function is a chkpoint_two
function,
the independent dynamic parameters are specified by calling its
new_dynamic
routine.
{
"op_code": op_code,
"name": "print"
}
A corresponding
op_usage
has the form
[ op_code, before, after, n_result, n_arg, [ notpos, value ] ]
json_unary_op.cpp | Json Unary Operators: Example and Test |
json_add_op.cpp | Json add Operator: Example and Test |
json_azmul_op.cpp | Json azmul Operator: Example and Test |
json_div_op.cpp | Json div Operator: Example and Test |
json_mul_op.cpp | Json mul Operator: Example and Test |
json_pow_op.cpp | Json pow Operator: Example and Test |
json_sub_op.cpp | Json sub Operator: Example and Test |
json_sum_op.cpp | Json sum Operator: Example and Test |
json_cexp_op.cpp | Json Conditional Expressions: Example and Test |
json_comp_op.cpp | Json Comparison Operators: Example and Test |
json_discrete_op.cpp | Json add Operator: Example and Test |
json_atom_op.cpp | Json Atomic Function Three Operator: Example and Test |
json_atom4_op.cpp | Json Atomic Function Operator: Example and Test |
json_print_op.cpp | Json AD Graph print Operator: Example and Test |