Commit 9bee2807 authored by Alberto Ramos's avatar Alberto Ramos

Error in hessianconfig when < 8 variables

parent a0ef5420
......@@ -167,7 +167,11 @@ function chiexp(chisq::Function,
xav[i] = data[i-n].mean
end
ccsq(x::Vector) = chisq(view(x, 1:n), view(x, n+1:n+m))
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{8}());
if (n+m < 4)
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{1}());
else
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{4}());
end
hess = Array{Float64}(undef, n+m, n+m)
ForwardDiff.hessian!(hess, ccsq, xav, cfg)
......@@ -271,7 +275,11 @@ function fit_error(chisq::Function,
end
ccsq(x::Vector) = chisq(x[1:n], x[n+1:n+m])
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{8}());
if (n+m < 4)
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{1}());
else
cfg = ForwardDiff.HessianConfig(ccsq, xav, Chunk{4}());
end
hess = Array{Float64}(undef, n+m, n+m)
ForwardDiff.hessian!(hess, ccsq, xav, cfg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment