Skip to content

possibility for a warning when if is used inappropriately in TMB code #362

@bbolker

Description

@bbolker

The fact that

You should not use if(x) statements where x is a PARAMETER, or is derived from a variable of type PARAMETER. (It is OK to use if on DATA types, however.) TMB will remove the if(x) statement, so the code will produce unexpected results.

is clearly documented here (and the reason is clear at least in hindsight if one thinks about differentiability).

Would it be technically feasible to issue a warning in this case?

(As a side note, is it worth mentioning CppAD::CondExpLt and friends for those cases where it actually makes sense to branch [e.g. to switch between two different representations which work better in different parameter regimes, but are continuous/have continuous derivatives at the switch point] ?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions