-
Notifications
You must be signed in to change notification settings - Fork 55
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
RQIso cov function is type-unstable #35
Comments
For reference, here's the code for cov(rq::RQIso, r::Float64) = rq.σ2*(1.0+r/(2.0*rq.α*rq.ℓ2)).^(-rq.α) Changing it to cov(rq::RQIso, r::Float64) = rq.σ2*(1.0+r/(2.0*rq.α*rq.ℓ2))^(-rq.α) ( However, copy-pasting the function definition into the REPL, for some bizarre reason, does fix it: Variables:
#self#::Base.#cov
rq::GaussianProcesses.RQIso
r::Float64
Body:
begin
SSAValue(1) = (Core.getfield)(rq::GaussianProcesses.RQIso,:σ2)::Float64
SSAValue(0) = $(Expr(:invoke, LambdaInfo for ^(::Float64, ::Float64), :(Main.^), :((Base.box)(Base.Float64,(Base.add_float)(1.0,(Base.box)(Base.Float64,(Base.div_float)(r,(Base.box)(Base.Float64,(Base.mul_float)((Base.box)(Base.Float64,(Base.mul_float)(2.0,(Core.getfield)(rq,:α)::Float64)),(Core.getfield)(rq,:ℓ2)::Float64))))))), :((Base.box)(Base.Float64,(Base.neg_float)((Core.getfield)(rq,:α)::Float64)))))
return (Base.box)(Base.Float64,(Base.mul_float)(SSAValue(1),SSAValue(0)))
end::Float64 |
This problem seems to be caused by importing the module FooBar
using Optim
f(a::Float64, b::Float64) = a^b
end # module
|
So… it seems we're bumping into JuliaNLSolvers/Optim.jl#283 |
This is fixed in the development branch of julia 0.5 using GaussianProcesses
k2=RQIso(0.0,0.0,0.0)
cov(k2, 3.0)
@code_warntype cov(k2, 3.0) Variables:
#self#::Base.#cov
rq::GaussianProcesses.RQIso
r::Float64
Body:
begin
SSAValue(1) = (Core.getfield)(rq::GaussianProcesses.RQIso,:σ2)::Float64
SSAValue(0) = $(Expr(:invoke, LambdaInfo for ^(::Float64, ::Float64), :(GaussianProcesses.^), :((Base.box)(Base.Float64,(Base.add_float)(1.0,(Base.box)(Base.Float64,(Base.div_float)(r,(Base.box)(Base.Float64,(Base.mul_float)((Base.box)(Base.Float64,(Base.mul_float)(2.0,(Core.getfield)(rq,:α)::Float64)),(Core.getfield)(rq,:ℓ2)::Float64))))))), :((Base.box)(Base.Float64,(Base.neg_float)((Core.getfield)(rq,:α)::Float64)))))
return (Base.box)(Base.Float64,(Base.mul_float)(SSAValue(1),SSAValue(0)))
end::Float64 this should make it to the release of julia 0.5 soon, at which point we should close this issue. |
Agreed |
produces
I think this is actually a julia bug, but I'm not sure how to reproduce it...
The text was updated successfully, but these errors were encountered: