Open lentinj opened 4 years ago
It's a known issue. An alternative 'fix' is:
vector<Type> out2 = lgamma(vector<Type>(x + 0));
I admit it would be nice if such casts weren't necessary.
Oops, yes that would have been the sensible thing to do. Apologies.
Happy to make a pull request, adding a note to the docs to save future head-scratching. The most useful place I can see is http://kaskr.github.io/adcomp/_book/Errors.html#compilation-errors - does this seem like a plan? I can't any specific docs on the vectorized lgamma
, and it's not strictly an lgamma
problem anyway.
@lentinj
does this seem like a plan?
Yes - thanks.
Description:
Providing an expression argument
lgamma()
, amongst others, doesn't compile.Reproducible Steps:
Try compiling the following example:
The above code will only compile if the second example is commented out.
I (think!) this is due to function templates interacting badly with the lazy evaluation of
x + 0
. As it is handed one template expects to also return a "something + something" expression, which it can't do.The bodge in the third case uses the same
Type
as the objective_function, so the lazy evaluation is no longer a problem.Is there a better approach here I'm missing?
TMB Version:
R Version:
Operating System: