Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Vector{BigFloat} for parameters (#168)
* Allow Vector{BigFloat} for parameters When attempting to pass initial parameter configurations `p0` of type `Vector{BigFloat}` to `curve_fit`, one receives the error `UndefRefError: access to undefined reference`. The reason for this lies in the use of `similar`: For other types (e.g. `Vector{Float64}`) the method `similar(p0)` creates a new vector of the same type whose components are initialized with random values. In constrast, when applied to `Vector{BigFloat}`, a new vector of this type is created, however, its components are not yet initialized, i.e. they all have the value `#undef`! Therefore, when other methods from `NLSolversBase` attempt to access this newly created object further down the pipeline, one gets the error I described. Ultimately, I think this should be fixed in `Base.similar` but for now, changing `similar` to `copy` (which essentially achieves the same goal) solves the problem. I believe that allowing for arbitrary precision is an important feature of any optimization library. Since my own package also relies on **LsqFit.jl** for optimization, I would be grateful if this issue could be fixed soon - either as proposed here or in some other way. * Added BigFloat test for curve_fit() * Update test/curve_fit.jl Co-authored-by: Patrick Kofod Mogensen <[email protected]>
- Loading branch information