-
-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stub functions for certain std:: functions #2611
Comments
Are you sure about Running this compiles fine for me:
So I guess the question is how do I test this? The stanc3 PR branch and try to compile the model I guess? For stuff like atan2 its clear there is no implementation. |
| "ceil" ->
let std_prefix_data_scalar f = function
| [ Expr.({ Fixed.meta=
Typed.Meta.({adlevel= DataOnly; type_= UInt | UReal; _}); _
}) ] ->
"std::" ^ f
| _ -> "stan::math::" ^ f
in
Some
(fun ppf es ->
let f = std_prefix_data_scalar f es in
pp_call ppf (f, pp_expr, es) ) |
What I'll do is remove this special casing in the stanc3 branch and then we can test against that |
Oh, thats probably there from before the various Math refactors, one of which also added support for that in ceil(). I can confirm easily for the rest with a simple program, ceil() seems to work fine. |
Removing the
so it seems like |
If we only have |
Yeah, we do need to check that. Given that we already have all the infrastructure to generate tests on-the-fly for expression testing, I think its worth it to actually make a test with all the scalar signatures and then after calling all the functions check that no var was created. |
@rok-cesnovar --- that sounds perfect. @syclik and I introduced tests like this ages ago and I don't even know if they're sitting around, but the memory manager lets you inspect the allocations if you need to write from scratch. |
@rok-cesnovar have you had a chance to look at this yet? |
Yes, I am in the process of making a script to generate the tests mentioned above. I can fix the functions first if this is blocking you though. That can be done quick. |
This is related to stan-dev/stanc3#997 / stan-dev/stanc3#1011
There are several functions which we don't define in stan::math but rather use std:: (or don't qualify them at all) for when the argument is only reals or ints. As far as I can tell, these are:
It would be great to redirect these within the library, so we can codegen all functions as fully qualified, e.g.
stan::math::pow
.We may also need more definitions for
norm
andpow
of complex numbers, see this log for what currently failsThe text was updated successfully, but these errors were encountered: