-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I have modified the simple example in the documentation by changing the line
y[0] = a / 2;
to
if (a > 1.0) {
y[0] = a / 2;
} else {
y[0] = a * 2;
}
but this results in the following error:
terminate called after throwing an instance of 'CppAD::cg::CGException'
what(): GreaterThanOrZero cannot be called for non-parameters
This means that to generate the code for if/else statements I should use CppAD parameters. However, to the best of my knowledge, this feature is currently missing in CppADCodeGen, where parameters can only be emulated by editing the sparsity patterns of the models. Is there a way to generate the derivatives for code containing if/else statements? If yes, how should I modify the above example to make it work?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels