JuliaNLSolvers / LsqFit.jl

Simple curve fitting in Julia
Other
317 stars 78 forks source link

`stderror` throws `LinearAlgebra.LAPACKException(1)` with weighted least squares fitting. #234

Closed JaydevSR closed 1 year ago

JaydevSR commented 1 year ago

The trace of the error is:

ERROR: LinearAlgebra.LAPACKException(1)
Stacktrace:
 [1] chklapackerror
   @ C:\Users\Jaydev Singh Rao\.julia\juliaup\julia-1.8.2+0.x64\share\julia\stdlib\v1.8\LinearAlgebra\src\lapack.jl:41 [inlined]
 [2] trtrs!(uplo::Char, trans::Char, diag::Char, A::Matrix{Float64}, B::Matrix{Float64})
   @ LinearAlgebra.LAPACK C:\Users\Jaydev Singh Rao\.julia\juliaup\julia-1.8.2+0.x64\share\julia\stdlib\v1.8\LinearAlgebra\src\lapack.jl:3421
 [3] ldiv!
   @ C:\Users\Jaydev Singh Rao\.julia\juliaup\julia-1.8.2+0.x64\share\julia\stdlib\v1.8\LinearAlgebra\src\triangular.jl:729 [inlined]
 [4] inv(A::LinearAlgebra.UpperTriangular{Float64, Matrix{Float64}})
   @ LinearAlgebra C:\Users\Jaydev Singh Rao\.julia\juliaup\julia-1.8.2+0.x64\share\julia\stdlib\v1.8\LinearAlgebra\src\triangular.jl:811
 [5] inv(A::Matrix{Float64})
   @ LinearAlgebra C:\Users\Jaydev Singh Rao\.julia\juliaup\julia-1.8.2+0.x64\share\julia\stdlib\v1.8\LinearAlgebra\src\dense.jl:889
 [6] estimate_covar(fit::LsqFit.LsqFitResult{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}})
   @ LsqFit C:\Users\Jaydev Singh Rao\.julia\packages\LsqFit\BBrNp\src\curve_fit.jl:209
 [7] stderror(fit::LsqFit.LsqFitResult{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}; rtol::Float64,
 atol::Int64)
   @ LsqFit C:\Users\Jaydev Singh Rao\.julia\packages\LsqFit\BBrNp\src\curve_fit.jl:220
 [8] stderror(fit::LsqFit.LsqFitResult{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}})
   @ LsqFit C:\Users\Jaydev Singh Rao\.julia\packages\LsqFit\BBrNp\src\curve_fit.jl:215
 [9] top-level scope
   @ d:\Projects\Potts-QCD\potts-model-monte-carlo\sims2D\finite_size_scaling\chi_square_fits.jl:51

What seems to be the problem here?

pkofod commented 1 year ago

Problems during variance/covariance estimation/calculation step. You'd have to provide the example for me to say much more than that.

JaydevSR commented 1 year ago

Totally forgot to close this sorry. I just had a bug in the data processing step for the fit. I fixed it later 😓

thriveth commented 9 months ago

@JaydevSR What caused the problem for you? I am encountering this problem at the moment and I am not sure what to look for.

JaydevSR commented 9 months ago

Hi @thriveth, It was a long time ago but as far as I can remember it was because of some NaN values in my data, which I took care of to fix this. But I am not completely sure.