Skip to content
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

transformation_if_inf is not type stable #65

Closed
agerlach opened this issue May 7, 2021 · 9 comments · Fixed by #241
Closed

transformation_if_inf is not type stable #65

agerlach opened this issue May 7, 2021 · 9 comments · Fixed by #241
Assignees

Comments

@agerlach
Copy link
Collaborator

agerlach commented May 7, 2021

Updatingtransformation_if_inf is sufficient to make HCubatureJL() type stable. Other methods are still type unstable.

@YingboMa
Copy link
Member

Do you have an MWE?

@YingboMa
Copy link
Member

Since transformation_if_inf is kind of a f->g function. It's either going to be type unstable, or we need to introduce the extra overhead for every function call. We should add an argument like do_inf_transformation=Val{true}().

@agerlach
Copy link
Collaborator Author

I don't recall what exactly I meant by "updating". Here is a MWE I just put together, I'm not sure if it captures the same problem I had in the OP.

using Quadrature , Distributions , Test

μ = [0.00 , 0.00]
Σ = [0.4 0.0 ; 0.00 0.4]
d = MvNormal(μ , Σ)
m(x , p) = pdf(d, x)
prob = QuadratureProblem{false}(m, [-Inf , -Inf] , [Inf , Inf])
sol = solve(prob,HCubatureJL(),reltol=1e-3,abstol=1e-3)

@ChrisRackauckas
Copy link
Member

It's either going to be type unstable, or we need to introduce the extra overhead for every function call. We should add an argument like do_inf_transformation=Val{true}().

Could it not use a function barrier or something?

@YingboMa
Copy link
Member

Not really, because it's a higher order function.

@ChrisRackauckas
Copy link
Member

There must be something, we can chat about this at the summit.

@YingboMa
Copy link
Member

I mean transformation_if_inf is kind of like a function barrier, and it's type unstable. The actual integration is type stable.

@sharanry
Copy link
Contributor

sharanry commented Jun 23, 2022

@lxvm lxvm mentioned this issue Feb 25, 2024
5 tasks
@lxvm lxvm linked a pull request Mar 3, 2024 that will close this issue
5 tasks
@lxvm
Copy link
Collaborator

lxvm commented Mar 3, 2024

I've addressed this issue in #241 by making sure with tests that all solves in the package are type-stable. I also deprecated do_inf_transformation and opted to transform all problems at solve time instead of init time. Note this does not guarantee type-groundedness, e.g. HCubatureJL is only type grounded when the limits of integration are vectors with static length.

@lxvm lxvm closed this as completed Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants