You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Julia Version 1.8.5 and Optim v1.7.4
I am trying to optimize the following function, where a second order method is employed and the cost, gradient and hessian are calculated simultaneously. x is an array of length 2. optimize(only_fgh!((F,G,H,x) -> costgradhess(F,G,H,x,x_0,y_0,a,b,alpha)), x_in, Newton())
where x_0,y_0,a,b,alpha are parameters needed by costgradhess. The optimization process worked perfectly when I use Vector{Float64} type for x. However, I decided to use StaticArrays (MArrays to be specific) for x to increase performance. Here is what it looks like (the code is quite long, so I skipped some parts)
function costgradhess(F,G,H,x_in::MVector{2,Float64},x_0::SVector{3, Float64},y_0::SVector{3, Float64},
a::SVector{3, Float64},b::SVector{3, Float64},alpha::SVector{3, Float64})
if !(isnothing(G))
# G[1] = ... ; G[2] = ...
end
if !(isnothing(H))
# H[1,1] = ... ; H[2,2] = ... ; H[1,2] = ... ; H[2,1] = H[1,2]
end
if !(isnothing(F))
#return cost
end
end
However, I get the following error message (starting from the optimize function above).
I also get the same error when I declare the types of F,G and H above (Float64,MVector,and MMatrix). In addition, a very similar error message appears when I use SArrays.
Thank you very much for your help!
The text was updated successfully, but these errors were encountered:
Yes, that is not supported. You can find SArray/MArray support in the attempt at rewriting Optim from scratch in https://github.com/JuliaNLSolvers/NLSolvers.jl that is also a registered package but less tested. Let me know if you need help.
Hi,
I'm using Julia Version 1.8.5 and Optim v1.7.4
I am trying to optimize the following function, where a second order method is employed and the cost, gradient and hessian are calculated simultaneously. x is an array of length 2.
optimize(only_fgh!((F,G,H,x) -> costgradhess(F,G,H,x,x_0,y_0,a,b,alpha)), x_in, Newton())
where x_0,y_0,a,b,alpha are parameters needed by costgradhess. The optimization process worked perfectly when I use Vector{Float64} type for x. However, I decided to use StaticArrays (MArrays to be specific) for x to increase performance. Here is what it looks like (the code is quite long, so I skipped some parts)
However, I get the following error message (starting from the optimize function above).
I also get the same error when I declare the types of F,G and H above (Float64,MVector,and MMatrix). In addition, a very similar error message appears when I use SArrays.
Thank you very much for your help!
The text was updated successfully, but these errors were encountered: