Giter Club home page Giter Club logo

dierckx.jl's People

Contributors

bshall avatar carlolucibello avatar getzze avatar giordano avatar jdtuck avatar jgoldfar avatar jishnub avatar jtravs avatar julienpascal avatar jw3126 avatar kaarthiksundar avatar kbarbary avatar musm avatar mweastwood avatar staticfloat avatar swt30 avatar tkelman avatar yakir12 avatar yha avatar yuyichao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dierckx.jl's Issues

not compiling on mac?

I get

FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
make: *** [bispeu.o] Error 1
===============================[ ERROR: Dierckx ]===============================

LoadError: failed process: Process(`make FC=gfortran SUFFIX=dylib`, ProcessExited(2)) [2]

when running Pkg.add("Dierckx"), can I fix this somehow?

building error for v0.4.0

Really happy to see work on Dierckx for Julia v0.7 and v1.0 ... but getting build errors. Here is what I get after deleting ~/.julia for fresh install.

(v0.7) pkg> add Dierckx
   Cloning default registries into /Users/ethananderes/.julia/registries
   Cloning registry General from "https://github.com/JuliaRegistries/General.git"
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed Dierckx ──────── v0.4.0
 Installed BinaryProvider ─ v0.4.0
  Updating `~/.julia/environments/v0.7/Project.toml`
  [39dd38d3] + Dierckx v0.4.0
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [b99e7846] + BinaryProvider v0.4.0
  [39dd38d3] + Dierckx v0.4.0
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [b77e0a4c] + InteractiveUtils
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  Building Dierckx → `~/.julia/packages/Dierckx/5DgyM/deps/build.log`
┌ Error: Error building `Dierckx`:
│ [ Info: Downloading https://github.com/kbarbary/DierckxBuilder/releases/download/v1.0.0/libddierckx.v1.0.0.x86_64-apple-darwin14.tar.gz to /Users/ethananderes/.julia/packages/Dierckx/5DgyM/deps/usr/downloads/libddierckx.v1.0.0.x86_64-apple-darwin14.tar.gz...
│ ERROR: LoadError: LibraryProduct(nothing, ["libddierckx"], :libddierckx, "Prefix(/Users/ethananderes/.julia/packages/Dierckx/5DgyM/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #write_deps_file#134(::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /Users/ethananderes/.julia/packages/BinaryProvider/ZbFxn/src/Products.jl:393
│  [3] write_deps_file(::String, ::Array{LibraryProduct,1}) at /Users/ethananderes/.julia/packages/BinaryProvider/ZbFxn/src/Products.jl:380
│  [4] top-level scope at none:0
│  [5] include at ./boot.jl:317 [inlined]
│  [6] include_relative(::Module, ::String) at ./loading.jl:1038
│  [7] include(::Module, ::String) at ./sysimg.jl:29
│  [8] include(::String) at ./client.jl:398
│  [9] top-level scope at none:0
│ in expression starting at /Users/ethananderes/.julia/packages/Dierckx/5DgyM/deps/build.jl:38
[03:21:03] ######################################################################## 100.0%
└ @ Pkg.Operations ~/Software/julia7/usr/share/julia/stdlib/v0.7/Pkg/src/Operations.jl:1068

julia> versioninfo()
Julia Version 0.7.1-pre.0
Commit 36cddc1006 (2018-08-09 00:19 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin17.7.0)
  CPU: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
Environment:
  JULIA_FFTW_PROVIDER = MKL

This reminds me of the problems with Arpack for users who build Julia from source issue 5. Indeed the error message I get is very similar. Just thought I would mention in case the error is related.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

How to cite this package

Dear Developers,

It's a wonderful work!

I'm currently using this package for my thesis about modeling a biological systems, and preparing for publication. Hence, I'd like to know how to cite the package in my paper.

My manuscript is written in Latex, so feel free to upload .bib format.

Thank you.

Shao-Ting Chiu

Optimizing a spline

If I use this package to interpolate a function/spline, how can I optimize that function? I guess if I am using linear interpolation I can just optimize it by looking at the initial data, but I'm not sure that would hold for e.g. quadratic interpolation?

As an example, I try:

x = [0., 1., 2., 3., 4.]
y = [0., 2., 4., 6., 8.]  
spl = Spline1D(x, y)
optimize(spl,0,10)

I get:

MethodError: no method matching optimize(::Spline1D, ::Int64, ::Int64)

I believe this should work if spl was just a regular Julia function.
So I guess this is part of a more general question: how can I convert the output of interpolation (the spline) to become a regular Julia function?

Thanks

Need a Tag Please

Any chance to get a tag soon? the last one is quite old and I need to tell everybody to checkout Dierckx at the moment,

Unable to use Dierckx with Julia 0.3.5

Hello everyone,

Since upgrading to julia 0.3.5 I have been unable to use Dierckx:

julia> using Dierckx
ERROR: Dierckx not properly installed. Run Pkg.build("Dierckx")
 in error at error.jl:21
 in include at /Applications/Julia-0.3.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in include_from_node1 at /Applications/Julia-0.3.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /Users/mathieu/.julia/Dierckx/src/Dierckx.jl, in expression starting on line 20

The error remains after running Pkg.build("Dierckx"). I'm on Mac OS X Yosemite and using gcc.

Thanks!
Mathieu

Move to Project.toml

Are there plans to move to Project.toml and remove REQUIRE. Are PRs welcome for this?

3D Splines?

Hello! The package looks very impressive! I'm looking for something like this to use in my work and the Julia interpolation landscape looks pretty scary right now. Do you expect to eventually allow for 3D splines?

Is there some unpleasant work-around where I can do 1D + 2D nested somehow? Any idea is greatly appreciated!

Build Error on Mac OS Mojave

Julia: Version 1.2.0 (2019-08-20)

Building Dierckx → ~/.julia/packages/Dierckx/ZTanR/deps/build.log
┌ Error: Error building Dierckx:
│ ERROR: LoadError: Your platform ("x86_64-apple-darwin18.7.0", parsed as "x86_64-apple-darwin14-gcc4-cxx03") is not supported by this package!
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] top-level scope at /Users/narora/.julia/packages/Dierckx/ZTanR/deps/build.jl:44
│ [3] include at ./boot.jl:328 [inlined]
│ [4] include_relative(::Module, ::String) at ./loading.jl:1094
│ [5] include(::Module, ::String) at ./Base.jl:31
│ [6] include(::String) at ./client.jl:431
│ [7] top-level scope at none:5
│ in expression starting at /Users/narora/.julia/packages/Dierckx/ZTanR/deps/build.jl:40

Error in adding Package "Dierckx"

Error: Error building Dierckx:
│ ERROR: LoadError: SystemError: opening file "C:\Users\abhis\JuliaPro\Julia-1.5.0\share\julia\stdlib\v1.5\BinaryProvider\JuliaTeam.toml": No such file or directory

Could you please let me know how to solve this problem in JuliaPro 1.5

extrapolation

Hey,

Are there any plans to include extrapolation options in 2D like in 1D? Thanks

Tag a new release?

Would you mind tagging a new release? We would like to use this on a PPC machine, but the current release isn't set up to use Dierckx_jll which provides the necessary binaries.

cc: @christophernhill

`roots` sometimes cannot find the correct root(s)

MWE:

using Dierckx
x = [
    -7.800000000000001,
    -7.7,
    -7.6000000000000005,
    -7.5,
    -7.4,
    -7.300000000000001,
];

y = [
    -0.02749549159389436,
    -0.01838389014507258,
    -0.00921755334192842,
     1.1102230246251565e-16,
     0.009265146320801443,
     0.018574158954026365,
];

spline = Spline1D(x,y)
roots(spline) #! No root

spline = Spline1D(x,y,s=1.0)
roots(spline) # correct


y2 = [
    -0.02749549159389436,
    -0.01838389014507258,
    -0.00921755334192842,
     0.0,
     0.009265146320801443,
     0.018574158954026365,
];

spline = Spline1D(x,y2)
roots(spline) # correct


y3 = [
    -0.02749549159389436,
    -0.01838389014507258,
    -0.00921755334192842,
    1.1102230246251565e-14,
     0.009265146320801443,
     0.018574158954026365,
];

spline = Spline1D(x,y3)
roots(spline) #! No root


y4 = [
    -0.02749549159389436,
    -0.01838389014507258,
    -0.00921755334192842,
    1.1102230246251565e-13,
     0.009265146320801443,
     0.018574158954026365,
];

spline = Spline1D(x,y4)
roots(spline) # correct

Output:

julia> using Dierckx

julia> x = [                                                                                                                                              
           -7.800000000000001,                                                                                                                            
           -7.7,                                                                                                                                          
           -7.6000000000000005,                                                                                                                           
           -7.5,                                                                                                                                          
           -7.4,                                                                                                                                          
           -7.300000000000001,                                                                                                                            
       ];

julia> 

julia> y = [                                                                                                                                              
           -0.02749549159389436,                                                                                                                          
               -0.01838389014507258,                                                                                                                      
           -0.00921755334192842,                                                                                                                          
            1.1102230246251565e-16,                                                                                                                       
            0.009265146320801443,                                                                                                                         
            0.018574158954026365,                                                                                                                         
       ];

julia> 

julia> spline = Spline1D(x,y)
Spline1D(knots=[-7.800000000000001, -7.6000000000000005, -7.5, -7.300000000000001], k=3, extrapolation="nearest", residual=0.0)

julia> roots(spline) #! No root
Float64[]

julia> 

julia> spline = Spline1D(x,y,s=1.0)
Spline1D(knots=[-7.800000000000001, -7.300000000000001], k=3, extrapolation="nearest", residual=1.5429392612813467e-15)

julia> y4 = [
           -0.02749549159389436,
           -0.01838389014507258,
           -0.00921755334192842,
           1.1102230246251565e-13,
            0.009265146320801443,
            0.018574158954026365,
       ];

julia>

julia> spline = Spline1D(x,y4)
Spline1D(knots=[-7.800000000000001, -7.6000000000000005, -7.5, -7.300000000000001], k=3, extrapolation="nearest", residual=0.0)

julia> roots(spline) # correct
1-element Vector{Float64}:
 -7.500000000000101

Environment:

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) W-10885M CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_DEPOT_PATH = E:\.julia
  JULIA_NUM_THREADS = 8
  JULIA_EDITOR = code

(@v1.7) pkg> st Dierckx
      Status `E:\.julia\environments\v1.7\Project.toml`
  [39dd38d3] Dierckx v0.5.2

Doesn't build on Mac

Hello everyone,

I am trying to add Dierckx on my Mac using Julia v0.5, but keep getting the following error message:

make: *** [libddierckx.dylib] Error 1
=================================================[ ERROR: Dierckx ]=================================================

LoadError: failed process: Process(make FC=gfortran SUFFIX=dylib, ProcessExited(2)) [2]
while loading /Users/erica/.julia/v0.5/Dierckx/deps/build.jl, in expression starting on line 10

==================================================[ BUILD ERRORS ]==================================================

WARNING: Dierckx had build errors.

  • packages with build errors remain installed in /Users/erica/.julia/v0.5
  • build the package(s) and all dependencies with Pkg.build("Dierckx")
  • build a single package by running its deps/build.jl script

I do have gfortran installed in my computer. I am using OS X EI Capitan 10.11.6. Any help will be greatly appreciated.

Thanks!
Erica

Spline2D with 1D Array z values

Seems not to work, here my simple example that does not work.

using Dierckx
x=[0.7, 5.3, 3.3, 7.8, 2.2, 7.3]
y=[0.9, 0.6, 3.1, 2.1, 4.8, 4.2]
z=[3., 4., 7., 12., 18., 9.]
Spline2D(x, y, z)

error message is:
LoadError: Error on entry, no approximation returned. The following conditions
must hold:
xb<=x[i]<=xe, yb<=y[i]<=ye, w[i]>0, i=0..m-1
If iopt==-1, then
xb<tx[kx+1]<tx[kx+2]<...<tx[nx-kx-2]<xe
yb<ty[ky+1]<ty[ky+2]<...<ty[ny-ky-2]<ye
in expression starting at

Thanks

Spline2D fails with large number of unstructured points

Thanks for the great work in wrapping this library. For the work I do spline surface fitting is very useful.

I'm working with a noisy data set, and trying to generate a roughly 20 x 40 fit with kx=3 control points to a data set with a million or more points. When I call Spline2D, it fails trying to convert an out of range lwrk1=2495786006 to an Int32.

In fact the data set is gridded, but with missing values. The missing values (coded as NaNs) seem to cause the 2D Z version to fail (not that surprising). It does work well if I pass in a contiguous region, even with a few million points.

One thought is that lwrk1 is being calculated overly conservatively for the 1D Z case.

Another question is is there any formula for the the returned grid size given the input size and the s parameter? Ideally, I would like to pass in the the grid I want my control points on, but I'm not sure that this is supported by the underlying library.

Integrate Spline2D along 1 dimension

Hi,

I'd like to perform a 1D integral over a Spline2D object (and possibly retain a Spline1D object) but couldn't find this in the documentation nor could I devise a way to do it myself..

Is there any for that already?

Thanks!

Migrating CI to GitHub Actions

@kbarbary

Travis CI is no longer free for open-source projects from 2021. Hence, pushed a commit to master to migrate CI to GitHub Actions. This has been the trend for most Julia Packages. Please feel free to disable CI in your Travis profile when you find time. Let me know once that is done, I can update badges, remove the travis.yml and appveyor.yml files, and release a patch version.

Thanks
Kaarthik

1D spline smoothing with knot locations specified

Currently, the wrapper for Spline1D that allows for user-specified knot locations does not allow for smoothing:

function Spline1D(x::AbstractVector, y::AbstractVector,

Instead, the smoothing parameter input is hardcoded to s=-1.0 here:

-1, m, xin, yin, win, xin[1], xin[end], k, -1.0,

and here:

-1, m, xin, yin, win, k, -1.0, n, n, t, c,

I propose the following nonbreaking modification:

function Spline1D(x::AbstractVector, y::AbstractVector,
    knots::AbstractVector;
    w::AbstractVector=ones(length(x)),
    k::Int=3, s::Real=-1.0, bc::AbstractString="nearest",
    periodic::Bool=false)
m = length(x)
length(y) == m || error("length of x and y must match")
length(w) == m || error("length of x and w must match")
m > k || error("k must be less than length(x)")
length(knots) <= m + k + 1 || error("length(knots) <= length(x) + k + 1 must hold")
first(x) < first(knots) || error("first(x) < first(knots) must hold")
last(x) > last(knots) || error("last(x) > last(knots) must hold")

# ensure inputs are of correct type
xin = convert(Vector{Float64}, x)
yin = convert(Vector{Float64}, y)
win = convert(Vector{Float64}, w)

# x knots
# (k+1) knots will be added on either end of interior knots.
n = length(knots) + 2(k + 1)
t = Vector{Float64}(undef, n)  # All knots
t[k+2:end-k-1] = knots

# outputs
c = Vector{Float64}(undef, n)
fp = Ref{Float64}(0)
ier = Ref{Int32}(0)

# workspace
lwrk = 0
if periodic
lwrk = m * (k + 1) + n*(8 + 5k)
else
lwrk = m * (k + 1) + n*(7 + 3k)
end
wrk = Vector{Float64}(undef, lwrk)
iwrk = Vector{Int32}(undef, n)

if !periodic
ccall((:curfit_, libddierckx), Nothing,
(Ref{Int32}, Ref{Int32},  # iopt, m
Ref{Float64}, Ref{Float64}, Ref{Float64},  # x, y, w
Ref{Float64}, Ref{Float64},  # xb, xe
Ref{Int32}, Ref{Float64},  # k, s
Ref{Int32}, Ref{Int32}, # nest, n
Ref{Float64}, Ref{Float64}, Ref{Float64},  # t, c, fp
Ref{Float64}, Ref{Int32}, Ref{Int32},  # wrk, lwrk, iwrk
Ref{Int32}),  # ier
-1, m, xin, yin, win, xin[1], xin[end], k, Float64(s),
n, n, t, c, fp, wrk, lwrk, iwrk, ier)
else
ccall((:percur_, libddierckx), Nothing,
(Ref{Int32}, Ref{Int32}, # iopt, m
Ref{Float64}, Ref{Float64}, Ref{Float64}, # x, y, w
Ref{Int32}, Ref{Float64}, # k, s
Ref{Int32}, Ref{Int32}, # nest, n
Ref{Float64}, Ref{Float64}, Ref{Float64}, # t, c, fp
Ref{Float64}, Ref{Int32}, Ref{Int32}, # wrk, lwrk, iwrk
Ref{Int32}), # ier
-1, m, xin, yin, win, k, Float64(s), n, n, t, c,
fp, wrk, lwrk, iwrk, ier)
end

ier[] <= 0 || error(_fit1d_messages[ier[]])
resize!(c, n - k - 1)

return Spline1D(t, c, k, _translate_bc(bc), fp[])
end

Periodic ParametricSpline() does not accept an 's' argument

When trying to fit a periodic ParametricSpline() the function does not accept an s argument

Slightly modified example form the runtest.jl:
x = [23. 24. 25. 25. 24. 23.;
13. 12. 12. 13. 13. 13.]
spl = ParametricSpline(x, periodic=true,s=1)

Error message:
ERROR: KeyError: key 1 not found
Stacktrace:
[1] getindex at ./dict.jl:478 [inlined]
[2] _ParametricSpline(::Nothing, ::Array{Float64,2}, ::Nothing, ::Array{Float64,1}, ::Int64, ::Int64, ::String, ::Bool) at /home/user/.julia/packages/Dierckx/9SY4A/src/Dierckx.jl:573
[3] #ParametricSpline#5 at /home/user/.julia/packages/Dierckx/9SY4A/src/Dierckx.jl:433 [inlined]
[4] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:periodic, :s),Tuple{Bool,Int64}}, ::Type{ParametricSpline}, ::Array{Float64,2}) at ./none:0
[5] top-level scope at none:0

Without s=1 or with s=0 everything works fine

Thanks for your help
Alex

Package Installation Fails on OS X Julia v0.5

julia> Pkg.add("Dierckx")
INFO: Installing Dierckx v0.1.9
INFO: Building Dierckx
make: Nothing to be done for `all'.
julia> import Dierckx
INFO: Precompiling module Dierckx.
WARNING: Module Compat with uuid 210707374708653 is missing from the cache.
This may mean module Compat does not support precompilation but is imported by a module that does.
ERROR: LoadError: Declaring __precompile__(false) is not allowed in files that are being precompiled.
 in require(::Symbol) at ./loading.jl:385
 in require(::Symbol) at /Users/ortner/gits/julia/usr/lib/julia/sys.dylib:?
 in include_from_node1(::String) at ./loading.jl:488
 in include_from_node1(::String) at /Users/ortner/gits/julia/usr/lib/julia/sys.dylib:?
 in macro expansion; at ./none:2 [inlined]
 in anonymous at ./<missing>:?
 in eval(::Module, ::Any) at ./boot.jl:234
 in eval(::Module, ::Any) at /Users/ortner/gits/julia/usr/lib/julia/sys.dylib:?
 in process_options(::Base.JLOptions) at ./client.jl:239
 in _start() at ./client.jl:318
 in _start() at /Users/ortner/gits/julia/usr/lib/julia/sys.dylib:?
while loading /Users/ortner/.julia/v0.5/Dierckx/src/Dierckx.jl, in expression starting on line 5
ERROR: Failed to precompile Dierckx to /Users/ortner/.julia/lib/v0.5/Dierckx.ji.
 in compilecache(::String) at ./loading.jl:593
 in require(::Symbol) at ./loading.jl:422
 in require(::Symbol) at /Users/ortner/gits/julia/usr/lib/julia/sys.dylib:?

If I then still try to import it,

julia> using Dierckx

julia> s = Spline1D(linspace(0,1,10), rand(10))
ERROR: error compiling #Spline1D#1: could not load library "/Users/ortner/.julia/v0.5/Dierckx/src/../deps/src/ddierckx/libddierckx"
dlopen(/Users/ortner/.julia/v0.5/Dierckx/src/../deps/src/ddierckx/libddierckx.dylib, 1): Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgfortran.3.dylib
  Referenced from: /Users/ortner/.julia/v0.5/Dierckx/deps/src/ddierckx/libddierckx.dylib
  Reason: image not found
 in Dierckx.Spline1D(::LinSpace{Float64}, ::Array{Float64,1}) at /Users/ortner/.julia/v0.5/Dierckx/src/Dierckx.jl:119

I checked and on my system /usr/local/opt/gcc/lib/gcc/5/libgfortran.3.dylib does not exist, instead the library is under .../6/....

Error when importing Dierckx

I get a recurring error message when trying to import Dierckx on Julia 0.6.2, OSX 10.13.3:

ERROR: InitError: Dierckx not properly installed. Run Pkg.build("Dierckx") Stacktrace: [1] __init__() at /Users/charles/.julia/v0.6/Dierckx/src/Dierckx.jl:28 [2] _include_from_serialized(::String) at ./loading.jl:157 [3] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200 [4] _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:236 [5] _require(::Symbol) at ./loading.jl:441 [6] require(::Symbol) at ./loading.jl:405 during initialization of module Dierckx

My fortran compiler runs fine (e.g. I can build my gcvspline Python app without problem). I tried reinstalling Dierckx, building it... When I try building it, it indicates:

INFO: Building Dierckx make: Nothing to be done for all'.`

I went in /Users/charles/.julia/v0.6/Dierckx/deps/src/ and manually built the fortran lib through a make, this works, but when I then tried again importing Dierckx I still got the same error...

I am quite puzzled at this stage. Any idea on the origin of this error?

Default k adapt to data length

Hello,
Currently this:

a=Spline1D([1,2,3],[2,4,8])

fails because k is 3 by default.
I propose that if the data length is 2, k=1, if it's 3, k=2, otherwise, k=3.
So the code change would likely be:

function Spline1D(x::AbstractVector, y::AbstractVector,
                  ...,
                  k::Int=min(length(x)-1,3), ...

Julia 0.7 and 1.0

Hi - I wanted to start experimenting with porting my own packages and Dierckx is a key dependency for me, so I removed all warnings for on the current master v0.7. If you are interested, I can make a PR, but I understand if you'd prefer to do it yourself.

(Also - I didn't bother with retaining v0.6 compatibility, as I never used Compat myself but just keep an old branch to which I backport bugfixes when needed.)

Could you tag a new version?

Hi could you tag a new version of the module, so windows users don't need to do Pkg.clone("Dierckx") instead of Pkg.add("Dierckx") to get the precompiled sources?

Build error on Windows

I am getting the following error when running code below. Not sure if this is related to #14 . Any help is greatly appreciated.

Pkg.add("Dierckx")
Pkg.build("Dierckx")

INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Dierckx
INFO: Use Pkg.update() to get the latest versions of your packages
INFO: Building Dierckx
===============================[ ERROR: Dierckx ]===============================

LoadError: could not spawn curl -LO https://cache.e.ip.saba.us/https://bintray.com/artifact/download/tkelman/generic/ddierckx.7z: no such file or directory (ENOENT)
while loading C:\Users\rand5.julia\v0.4\Dierckx\deps\build.jl, in expression starting on line 15

================================[ BUILD ERRORS ]================================

WARNING: Dierckx had build errors.

  • packages with build errors remain installed in C:\Users\rand5.julia\v0.4
  • build the package(s) and all dependencies with Pkg.build("Dierckx")
  • build a single package by running its deps/build.jl script

add dependency on gfortran and libpcre

I'm trying to get travis testing working on a package I'm writing, and I kept having failure's building Dierckx. I added a in in my .travis.yml file installing libpcre3-dev and gfortran based upon your file and things work fine now. But probably it would be better to resolve those dependencies, I think the BinDeps package can do it, but I'm not particularly familiar with it.

The required storage space exceeds the available storage space: nxest or nyest too small, or s too small. Try increasing s.

I have three vectors of length 100 each resembling $x$, $y$, $f(x,y)$. I was interested in drawing a contour plot for $f(x,y)$ and had to consider interpolation. 

using Dierckx

x = [0.7222222222222222, 0.7777777777777778, 0.9444444444444444, 0.6666666666666666, 0.8333333333333334, 0.6111111111111112, 0.5555555555555556, 0.6666666666666666, 0.7777777777777778, 0.5555555555555556, 0.8333333333333334, 1.0, 0.7777777777777778, 1.0, 0.8888888888888888, 0.7222222222222222, 0.5, 0.6111111111111112, 0.5, 0.7222222222222222, 1.0, 0.6111111111111112, 0.8888888888888888, 0.6111111111111112, 0.8333333333333334, 0.7777777777777778, 0.6666666666666666, 0.7777777777777778, 0.8333333333333334, 0.6111111111111112, 0.7222222222222222, 0.5555555555555556, 1.0, 0.9444444444444444, 0.6666666666666666, 0.5555555555555556, 0.5, 1.0, 0.5, 0.5555555555555556, 0.6666666666666666, 0.7222222222222222, 0.5, 0.6666666666666666, 0.5, 0.6666666666666666, 0.5, 0.5, 0.8888888888888888, 0.5, 0.5555555555555556, 0.5, 0.6666666666666666, 0.9444444444444444, 0.9444444444444444, 0.7222222222222222, 0.7777777777777778, 0.7777777777777778, 1.0, 0.8888888888888888, 0.6666666666666666, 0.8888888888888888, 1.0, 1.0, 0.6666666666666666, 0.9444444444444444, 1.0, 0.7222222222222222, 0.7777777777777778, 0.6111111111111112, 0.8888888888888888, 0.8333333333333334, 0.7777777777777778, 0.6111111111111112, 0.6111111111111112, 0.8333333333333334, 0.8888888888888888, 0.8333333333333334, 0.5555555555555556, 0.5555555555555556, 0.5555555555555556, 0.6111111111111112, 0.5555555555555556, 0.7222222222222222, 0.7777777777777778, 0.9444444444444444, 0.6111111111111112, 0.9444444444444444, 0.8333333333333334, 0.7222222222222222, 0.9444444444444444, 0.8333333333333334, 0.9444444444444444, 0.7222222222222222, 0.8888888888888888, 0.9444444444444444, 0.8333333333333334, 0.8888888888888888, 1.0, 0.8888888888888888]
y = [14, 20, 16, 3, 20, 5, 1, 7, 3, 20, 5, 3, 16, 20, 14, 1, 18, 1, 9, 18, 16, 7, 1, 3, 3, 9, 14, 18, 12, 18, 12, 12, 18, 3, 5, 5, 20, 14, 16, 16, 18, 20, 5, 9, 14, 20, 7, 3, 20, 12, 3, 1, 1, 18, 9, 5, 14, 7, 12, 5, 12, 9, 5, 1, 16, 5, 9, 7, 5, 20, 16, 7, 12, 12, 14, 14, 7, 16, 18, 9, 7, 9, 14, 16, 1, 14, 16, 1, 1, 9, 12, 18, 7, 3, 18, 20, 9, 3, 7, 12]
z = [0.006351475623209886, 0.011192748898413877, 0.004869813973876742, 0.001973430001963981, 0.009828455136554337, 0.00210370674372345, 0.002932617074828051, 0.0021460030450976848, 0.0021064472224843816, 0.018569388523534642, 0.0018376404037600917, 0.0036225306262139788, 0.007482682565255224, 0.007131032347247583, 0.004456584509221484, 0.003003281876888257, 0.018586309525361132, 0.003156344687884357, 0.006318746373280446, 0.01131577175574574, 0.004708208753217299, 0.003104893305965483, 0.00396936565945406, 0.0018317064311792859, 0.0018317064311792859, 0.003306427312309828, 0.007232913551361197, 0.00999644509864749, 0.004170124250281455, 0.015006598674328778, 0.005691941071878802, 0.005691941071878802, 0.005444233904727671, 0.0032005569304788717, 0.0018297196325042988, 0.0018297196325042988, 0.022460278959845356, 0.004396831413497289, 0.01543652626721628, 0.01543652626721628, 0.012623995456497342, 0.012802543534932175, 0.003007342420199918, 0.003961503136936988, 0.01131342881554476, 0.01267546826341072, 0.003953598942253883, 0.0019166368974115793, 0.008737164036568254, 0.010356385891213842, 0.001655412724761279, 0.0026741604203963164, 0.0026741604203963164, 0.006123615117851082, 0.002475418051070661, 0.0022880575179344254, 0.005537379122449932, 0.002407227864717604, 0.0030050786079581266, 0.0018875613139429054, 0.005043713444238118, 0.0024697555808722523, 0.0021374928753109057, 0.004013058912260644, 0.011387335304916067, 0.002059691538507389, 0.002562908191253542, 0.002369250036851818, 0.0022115406156488658, 0.015559809356755317, 0.005115007059314164, 0.0021287165182972004, 0.0048347036575673895, 0.0048347036575673895, 0.008273675248584885, 0.008273675248584885, 0.002206107161964064, 0.006584619012148834, 0.015625743573359108, 0.003809130007045038, 0.003644814307748434, 0.004366148018770151, 0.009004309535968938, 0.009353990285657632, 0.0037291816631724686, 0.00466818260157363, 0.011519464107553692, 0.003908195259469911, 0.003908195259469911, 0.003376793575379169, 0.0033095963165339385, 0.007939051927745168, 0.0024812231111138276, 0.0020006363091174643, 0.006967420633901726, 0.0073927066920747575, 0.0028867822729466883, 0.002837234600979641, 0.0029393446137467353, 0.003984909190714827]

spline = Spline2D(x, y, z)

Whenever I try running this I get:

The required storage space exceeds the available storage space:
nxest or nyest too small, or s too small. Try increasing s.

I don't understand what storage space its complaining about or what is any of nxest, nyest, s. I can't find them in the docs either.

Any help would be appreciated. Thanks for the nice package.

Interpolation not type stable?

@code_warntype spline( 0.5 )

yields Any for the return type, when I tried this today.
Is it me or is it type unstable?

allow integration of a function of a spline

Would it be hard to allow for integration of a function of the spline?

For example

integrate( spl, a, b, (val) -> val^2 )

And then one integrates the square of the spline values.

Cannot build Dierckx on Julia 0.5

Could you please have a look at the following problem?

julia> Pkg.add("Dierckx")
INFO: Installing Dierckx v0.2.1
INFO: Building Dierckx
ifort -c -fPIC -O3 bispeu.f -o bispeu.o
make: ifort: No such file or directory
make: *** [bispeu.o] Error 1
gfortran -c -fPIC -O3 bispeu.f -o bispeu.o
gfortran -c -fPIC -O3 bispev.f -o bispev.o
gfortran -c -fPIC -O3 clocur.f -o clocur.o
gfortran -c -fPIC -O3 cocosp.f -o cocosp.o
gfortran -c -fPIC -O3 concon.f -o concon.o
gfortran -c -fPIC -O3 concur.f -o concur.o
gfortran -c -fPIC -O3 cualde.f -o cualde.o
gfortran -c -fPIC -O3 curev.f -o curev.o
gfortran -c -fPIC -O3 curfit.f -o curfit.o
gfortran -c -fPIC -O3 dblint.f -o dblint.o
gfortran -c -fPIC -O3 evapol.f -o evapol.o
gfortran -c -fPIC -O3 fourco.f -o fourco.o
gfortran -c -fPIC -O3 fpader.f -o fpader.o
gfortran -c -fPIC -O3 fpadno.f -o fpadno.o
gfortran -c -fPIC -O3 fpadpo.f -o fpadpo.o
gfortran -c -fPIC -O3 fpback.f -o fpback.o
gfortran -c -fPIC -O3 fpbacp.f -o fpbacp.o
gfortran -c -fPIC -O3 fpbfout.f -o fpbfout.o
/var/folders/70/hk09l6z97jz8zrc9bxwhfn780000gq/T//ccspuyc5.s:454:suffix or operands invalid for movq' /var/folders/70/hk09l6z97jz8zrc9bxwhfn780000gq/T//ccspuyc5.s:821:suffix or operands invalid for movq'
make: *** [fpbfout.o] Error 1
==============================[ ERROR: Dierckx ]===============================

LoadError: failed process: Process(make FC=gfortran SUFFIX=dylib, ProcessExited(2)) [2]
while loading /Users/work/.julia/v0.5/Dierckx/deps/build.jl, in expression starting on line 10

===============================================================================

===============================[ BUILD ERRORS ]================================

WARNING: Dierckx had build errors.

  • packages with build errors remain installed in /Users/work/.julia/v0.5
  • build the package(s) and all dependencies with Pkg.build("Dierckx")
  • build a single package by running its deps/build.jl script

===============================================================================
INFO: Package database updated

Doesn't build on Windows

Because it uses curl to download stuff, but curl is not necessarily around on Windows systems.

Thread-safety

Is it possible that Dierckx.jl is not thread safe? evaluation is fine but derivatives seem to fail; see below for an explanation.

# file mtsplines.jl
using Dierckx, Random, .Threads
let 
   xdat = range(0, 1, length=100)
   spl = Spline1D(xdat, exp.(xdat))
   Random.seed!(0)
   r = rand(10_000)
   s = zeros(nthreads())
   @threads for n = 1:length(r)
      s[threadid()] += Dierckx.derivative(spl, r[n])
   end
   @show sum(s) / length(r)
end

This script yields the following output:

(base) Fuji-2:temp ortner$ j16 --threads=1 mtsplines.jl 
sum(s) / length(r) = 1.7170295968665945
(base) Fuji-2:temp ortner$ j16 --threads=1 mtsplines.jl 
sum(s) / length(r) = 1.7170295968665945
(base) Fuji-2:temp ortner$ j16 --threads=4 mtsplines.jl 
sum(s) / length(r) = -792.7283310922177
(base) Fuji-2:temp ortner$ j16 --threads=4 mtsplines.jl 
sum(s) / length(r) = -104735.52438361687

Return NaN

Would you be open to a pull request that allowed a user to specify bc="NaN" which would, as expected, return NaN instead of a throwing an error?

Error messagem while trying to use Spline1D

I tried to use pkg Dierckx with Spline1D, but everytime is shown an error message :

MethodError: no method matching Dierckx.Spline1D(::Array{Float64,2}, ::Array{Float64,1}, ::Int64; w=[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0 … 1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0], k=3, bc="nearest")
Closest candidates are:
Dierckx.Spline1D(::Any, ::Any, ::Any, !Matched::Any, !Matched::Any) at C:\Users\ka5s1.julia\v0.5\Dierckx\src\Dierckx.jl:79 got unsupported keyword arguments "w", "k", "bc"
Dierckx.Spline1D(!Matched::Array{Float64,1}, ::Array{Float64,1}, ::Int64, !Matched::Int64, !Matched::Float64) at C:\Users\ka5s1.julia\v0.5\Dierckx\src\Dierckx.jl:79 got unsupported keyword arguments "w", "k", "bc"
Dierckx.Spline1D(!Matched::AbstractArray{T,1}, ::AbstractArray{T,1}; k, w, s, bc) at C:\Users\ka5s1.julia\v0.5\Dierckx\src\Dierckx.jl:119
...
in include_string(::String, ::String) at loading.jl:441
in eval(::Module, ::Any) at boot.jl:234
in (::Atom.##65#68)() at eval.jl:40
in withpath(::Atom.##65#68, ::Void) at utils.jl:30
in withpath(::Function, ::Void) at eval.jl:46
in macro expansion at eval.jl:109 [inlined]
in (::Atom.##64#67{Dict{String,Any}})() at task.jl:60

The code was:
using Dierckx x = Pos_ESP_Cor y = MVESP_Cor[7,:] spl = Spline1D(x, y, xknots=28; w=ones(length(Pos_ESP_Cor)), k=3, bc="nearest")

I'm trying to interpolate 28 points in a cubic spline. I tried many variations on the code, but the error message always appear.

The x points have different distances between each other. Is that a problem?

Spline2D gives not the same as Scipy griddata

I have this code where I used Spline2D and Scipy griddata and they do not give the same see:

@pyimport scipy.interpolate as si
using Dierckx
using PyPlot
let
    z = nodes[data_to_ansys[:,1],4]
    y = nodes[data_to_ansys[:,1],3]-579
    r = (z.^2 + y.^2)
    angle = atan2(y,z)
    val = data_to_ansys[:,2]
    x_grid = linspace(minimum(r),maximum(r),100)
    y_grid = linspace(minimum(angle),maximum(angle),100)
    X = repmat(x_grid,1,100)
    Y = repmat(y_grid,1,100)'
    out = si.griddata((r, angle), val, (X, Y ) ,method="linear")
    contourf(X,Y,out)
    colorbar()
    figure()
    s = Spline2D(r, angle, val; kx=1, ky=1, s=length(r))
    out = evalgrid(s,x_grid,y_grid)'
    contourf(x_grid,y_grid,out)
    colorbar()
end

image
It is the same algorithm behind what am I doing something differently?

Interpolation result is NaN for large number of samples

I get NaN as the result of interpolation when the number of samples is large (e.g., N = 700). I tried to reproduce the problem with a simpler set of samples, but I couldn't, so I copy and paste the problematic sample points and values below; sorry for the inconvenience.

xs = [8.000064047793606e-7, 8.000230069522153e-7, 8.000396098141591e-7, 8.000562133652352e-7, 8.000728176054861e-7, 8.000894225349546e-7, 8.00106028153684e-7, 8.001226344617173e-7, 8.001392414590971e-7, 8.001558491458663e-7, 8.00172457522068e-7, 8.001890665877453e-7, 8.002056763429408e-7, 8.002222867876977e-7, 8.002388979220586e-7, 8.002555097460667e-7, 8.00272122259765e-7, 8.002887354631964e-7, 8.003053493564036e-7, 8.003219639394298e-7, 8.003385792123181e-7, 8.003551951751113e-7, 8.003718118278524e-7, 8.003884291705842e-7, 8.004050472033498e-7, 8.004216659261924e-7, 8.004382853391548e-7, 8.0045490544228e-7, 8.004715262356107e-7, 8.004881477191903e-7, 8.005047698930617e-7, 8.00521392757268e-7, 8.005380163118519e-7, 8.005546405568565e-7, 8.005712654923252e-7, 8.005878911183006e-7, 8.006045174348258e-7, 8.006211444419438e-7, 8.006377721396977e-7, 8.006544005281306e-7, 8.006710296072856e-7, 8.006876593772053e-7, 8.007042898379331e-7, 8.007209209895121e-7, 8.007375528319853e-7, 8.007541853653957e-7, 8.007708185897861e-7, 8.007874525051998e-7, 8.0080408711168e-7, 8.008207224092698e-7, 8.00837358398012e-7, 8.008539950779496e-7, 8.008706324491258e-7, 8.00887270511584e-7, 8.00903909265367e-7, 8.009205487105177e-7, 8.009371888470795e-7, 8.009538296750955e-7, 8.009704711946086e-7, 8.009871134056622e-7, 8.010037563082989e-7, 8.010203999025621e-7, 8.010370441884952e-7, 8.010536891661409e-7, 8.010703348355424e-7, 8.010869811967429e-7, 8.011036282497858e-7, 8.011202759947138e-7, 8.011369244315702e-7, 8.011535735603979e-7, 8.011702233812404e-7, 8.011868738941408e-7, 8.012035250991422e-7, 8.012201769962877e-7, 8.012368295856203e-7, 8.012534828671833e-7, 8.012701368410202e-7, 8.012867915071738e-7, 8.013034468656871e-7, 8.013201029166035e-7, 8.013367596599665e-7, 8.013534170958188e-7, 8.013700752242038e-7, 8.013867340451646e-7, 8.014033935587443e-7, 8.014200537649864e-7, 8.01436714663934e-7, 8.014533762556301e-7, 8.01470038540118e-7, 8.014867015174411e-7, 8.015033651876425e-7, 8.015200295507654e-7, 8.015366946068527e-7, 8.015533603559481e-7, 8.015700267980948e-7, 8.015866939333359e-7, 8.016033617617145e-7, 8.016200302832739e-7, 8.016366994980574e-7, 8.016533694061084e-7, 8.0167004000747e-7, 8.016867113021853e-7, 8.017033832902978e-7, 8.017200559718508e-7, 8.017367293468873e-7, 8.017534034154509e-7, 8.017700781775845e-7, 8.017867536333314e-7, 8.018034297827354e-7, 8.018201066258393e-7, 8.018367841626864e-7, 8.0185346239332e-7, 8.018701413177837e-7, 8.018868209361206e-7, 8.01903501248374e-7, 8.01920182254587e-7, 8.019368639548032e-7, 8.019535463490658e-7, 8.019702294374182e-7, 8.019869132199035e-7, 8.020035976965653e-7, 8.020202828674466e-7, 8.020369687325911e-7, 8.02053655292042e-7, 8.020703425458424e-7, 8.02087030494036e-7, 8.021037191366658e-7, 8.021204084737754e-7, 8.021370985054081e-7, 8.021537892316072e-7, 8.02170480652416e-7, 8.021871727678781e-7, 8.022038655780366e-7, 8.02220559082935e-7, 8.022372532826167e-7, 8.022539481771249e-7, 8.022706437665032e-7, 8.02287340050795e-7, 8.023040370300434e-7, 8.02320734704292e-7, 8.023374330735843e-7, 8.023541321379634e-7, 8.023708318974729e-7, 8.023875323521562e-7, 8.024042335020566e-7, 8.024209353472177e-7, 8.024376378876829e-7, 8.024543411234952e-7, 8.024710450546987e-7, 8.024877496813361e-7, 8.025044550034516e-7, 8.025211610210879e-7, 8.025378677342889e-7, 8.025545751430979e-7, 8.025712832475585e-7, 8.025879920477139e-7, 8.026047015436076e-7, 8.026214117352833e-7, 8.02638122622784e-7, 8.026548342061538e-7, 8.026715464854356e-7, 8.02688259460673e-7, 8.027049731319095e-7, 8.027216874991889e-7, 8.027384025625543e-7, 8.027551183220492e-7, 8.027718347777173e-7, 8.027885519296019e-7, 8.028052697777466e-7, 8.028219883221949e-7, 8.028387075629902e-7, 8.028554275001762e-7, 8.028721481337961e-7, 8.028888694638937e-7, 8.029055914905124e-7, 8.029223142136958e-7, 8.029390376334873e-7, 8.029557617499306e-7, 8.029724865630691e-7, 8.029892120729462e-7, 8.030059382796058e-7, 8.03022665183091e-7, 8.030393927834458e-7, 8.030561210807136e-7, 8.030728500749376e-7, 8.030895797661617e-7, 8.031063101544297e-7, 8.031230412397847e-7, 8.031397730222704e-7, 8.031565055019305e-7, 8.031732386788084e-7, 8.031899725529478e-7, 8.032067071243924e-7, 8.032234423931854e-7, 8.032401783593708e-7, 8.032569150229918e-7, 8.032736523840924e-7, 8.032903904427159e-7, 8.033071291989062e-7, 8.033238686527066e-7, 8.033406088041609e-7, 8.033573496533128e-7, 8.033740912002055e-7, 8.033908334448831e-7, 8.034075763873888e-7, 8.034243200277666e-7, 8.034410643660601e-7, 8.034578094023127e-7, 8.03474555136568e-7, 8.034913015688701e-7, 8.035080486992623e-7, 8.035247965277881e-7, 8.035415450544917e-7, 8.035582942794161e-7, 8.035750442026055e-7, 8.035917948241033e-7, 8.036085461439531e-7, 8.03625298162199e-7, 8.03642050878884e-7, 8.036588042940525e-7, 8.036755584077476e-7, 8.036923132200134e-7, 8.037090687308932e-7, 8.037258249404311e-7, 8.037425818486707e-7, 8.037593394556554e-7, 8.037760977614292e-7, 8.037928567660357e-7, 8.038096164695187e-7, 8.03826376871922e-7, 8.038431379732888e-7, 8.038598997736634e-7, 8.038766622730894e-7, 8.038934254716106e-7, 8.039101893692703e-7, 8.039269539661128e-7, 8.039437192621814e-7, 8.039604852575202e-7, 8.039772519521727e-7, 8.039940193461827e-7, 8.040107874395941e-7, 8.040275562324504e-7, 8.040443257247957e-7, 8.040610959166734e-7, 8.040778668081276e-7, 8.040946383992018e-7, 8.041114106899402e-7, 8.041281836803861e-7, 8.041449573705834e-7, 8.041617317605761e-7, 8.041785068504078e-7, 8.041952826401225e-7, 8.042120591297638e-7, 8.042288363193754e-7, 8.042456142090014e-7, 8.042623927986856e-7, 8.042791720884717e-7, 8.042959520784034e-7, 8.043127327685247e-7, 8.043295141588793e-7, 8.043462962495113e-7, 8.043630790404643e-7, 8.043798625317821e-7, 8.043966467235087e-7, 8.044134316156877e-7, 8.044302172083633e-7, 8.04447003501579e-7, 8.04463790495379e-7, 8.044805781898069e-7, 8.044973665849067e-7, 8.045141556807222e-7, 8.045309454772972e-7, 8.045477359746758e-7, 8.045645271729016e-7, 8.045813190720188e-7, 8.04598111672071e-7, 8.046149049731021e-7, 8.046316989751561e-7, 8.04648493678277e-7, 8.046652890825086e-7, 8.046820851878947e-7, 8.046988819944793e-7, 8.047156795023062e-7, 8.047324777114197e-7, 8.047492766218633e-7, 8.04766076233681e-7, 8.047828765469169e-7, 8.047996775616147e-7, 8.048164792778185e-7, 8.048332816955722e-7, 8.048500848149197e-7, 8.04866888635905e-7, 8.04883693158572e-7, 8.049004983829648e-7, 8.04917304309127e-7, 8.049341109371029e-7, 8.049509182669363e-7, 8.049677262986713e-7, 8.049845350323517e-7, 8.050013444680215e-7, 8.050181546057247e-7, 8.050349654455056e-7, 8.050517769874077e-7, 8.050685892314752e-7, 8.050854021777521e-7, 8.051022158262822e-7, 8.0511903017711e-7, 8.05135845230279e-7, 8.051526609858333e-7, 8.051694774438172e-7, 8.051862946042742e-7, 8.052031124672489e-7, 8.052199310327849e-7, 8.052367503009264e-7, 8.052535702717173e-7, 8.052703909452019e-7, 8.052872123214242e-7, 8.053040344004277e-7, 8.053208571822571e-7, 8.053376806669561e-7, 8.05354504854569e-7, 8.053713297451397e-7, 8.05388155338712e-7, 8.054049816353303e-7, 8.054218086350388e-7, 8.054386363378813e-7, 8.054554647439017e-7, 8.054722938531444e-7, 8.054891236656534e-7, 8.055059541814728e-7, 8.055227854006468e-7, 8.055396173232191e-7, 8.055564499492342e-7, 8.055732832787359e-7, 8.055901173117686e-7, 8.05606952048376e-7, 8.056237874886028e-7, 8.056406236324925e-7, 8.056574604800896e-7, 8.056742980314382e-7, 8.056911362865821e-7, 8.057079752455659e-7, 8.057248149084332e-7, 8.057416552752286e-7, 8.057584963459962e-7, 8.057753381207798e-7, 8.057921805996237e-7, 8.058090237825724e-7, 8.058258676696695e-7, 8.058427122609595e-7, 8.058595575564866e-7, 8.058764035562945e-7, 8.058932502604281e-7, 8.059100976689311e-7, 8.059269457818476e-7, 8.05943794599222e-7, 8.059606441210985e-7, 8.059774943475212e-7, 8.059943452785341e-7, 8.060111969141819e-7, 8.060280492545082e-7, 8.060449022995578e-7, 8.060617560493745e-7, 8.060786105040024e-7, 8.060954656634862e-7, 8.061123215278696e-7, 8.061291780971973e-7, 8.061460353715132e-7, 8.061628933508615e-7, 8.061797520352865e-7, 8.061966114248327e-7, 8.062134715195441e-7, 8.062303323194647e-7, 8.062471938246393e-7, 8.062640560351117e-7, 8.062809189509264e-7, 8.062977825721276e-7, 8.063146468987593e-7, 8.063315119308663e-7, 8.063483776684922e-7, 8.06365244111682e-7, 8.063821112604793e-7, 8.06398979114929e-7, 8.064158476750748e-7, 8.064327169409614e-7, 8.06449586912633e-7, 8.064664575901337e-7, 8.064833289735081e-7, 8.065002010628001e-7, 8.065170738580545e-7, 8.065339473593153e-7, 8.065508215666268e-7, 8.065676964800333e-7, 8.065845720995794e-7, 8.066014484253092e-7, 8.066183254572669e-7, 8.066352031954973e-7, 8.066520816400441e-7, 8.066689607909523e-7, 8.066858406482657e-7, 8.067027212120288e-7, 8.067196024822862e-7, 8.067364844590818e-7, 8.067533671424604e-7, 8.067702505324661e-7, 8.067871346291435e-7, 8.068040194325367e-7, 8.068209049426901e-7, 8.068377911596484e-7, 8.068546780834555e-7, 8.068715657141562e-7, 8.068884540517945e-7, 8.069053430964152e-7, 8.069222328480624e-7, 8.069391233067806e-7, 8.069560144726142e-7, 8.069729063456076e-7, 8.069897989258053e-7, 8.070066922132514e-7, 8.070235862079908e-7, 8.070404809100675e-7, 8.070573763195262e-7, 8.070742724364113e-7, 8.070911692607668e-7, 8.071080667926379e-7, 8.071249650320682e-7, 8.071418639791028e-7, 8.071587636337859e-7, 8.07175663996162e-7, 8.071925650662754e-7, 8.072094668441708e-7, 8.072263693298926e-7, 8.072432725234849e-7, 8.072601764249928e-7, 8.072770810344601e-7, 8.072939863519319e-7, 8.073108923774524e-7, 8.07327799111066e-7, 8.073447065528171e-7, 8.073616147027506e-7, 8.073785235609107e-7, 8.073954331273419e-7, 8.074123434020888e-7, 8.074292543851959e-7, 8.074461660767077e-7, 8.074630784766686e-7, 8.074799915851232e-7, 8.074969054021162e-7, 8.075138199276917e-7, 8.075307351618947e-7, 8.075476511047692e-7, 8.075645677563604e-7, 8.075814851167122e-7, 8.075984031858698e-7, 8.076153219638772e-7, 8.076322414507789e-7, 8.0764916164662e-7, 8.076660825514446e-7, 8.076830041652975e-7, 8.076999264882232e-7, 8.077168495202661e-7, 8.077337732614708e-7, 8.077506977118823e-7, 8.077676228715448e-7, 8.077845487405028e-7, 8.078014753188013e-7, 8.078184026064843e-7, 8.07835330603597e-7, 8.078522593101837e-7, 8.07869188726289e-7, 8.078861188519577e-7, 8.079030496872339e-7, 8.079199812321629e-7, 8.079369134867888e-7, 8.079538464511565e-7, 8.079707801253104e-7, 8.079877145092955e-7, 8.080046496031561e-7, 8.08021585406937e-7, 8.080385219206827e-7, 8.080554591444378e-7, 8.080723970782473e-7, 8.080893357221556e-7, 8.081062750762072e-7, 8.081232151404469e-7, 8.081401559149197e-7, 8.081570973996699e-7, 8.081740395947421e-7, 8.081909825001812e-7, 8.082079261160317e-7, 8.082248704423384e-7, 8.082418154791461e-7, 8.082587612264992e-7, 8.082757076844427e-7, 8.082926548530209e-7, 8.08309602732279e-7, 8.083265513222612e-7, 8.083435006230126e-7, 8.083604506345777e-7, 8.083774013570013e-7, 8.083943527903282e-7, 8.084113049346029e-7, 8.084282577898704e-7, 8.084452113561751e-7, 8.084621656335621e-7, 8.084791206220759e-7, 8.084960763217611e-7, 8.085130327326627e-7, 8.085299898548256e-7, 8.085469476882942e-7, 8.085639062331133e-7, 8.08580865489328e-7, 8.085978254569827e-7, 8.086147861361224e-7, 8.086317475267916e-7, 8.086487096290353e-7, 8.086656724428984e-7, 8.086826359684251e-7, 8.08699600205661e-7, 8.087165651546503e-7, 8.08733530815438e-7, 8.087504971880688e-7, 8.087674642725877e-7, 8.087844320690395e-7, 8.088014005774686e-7, 8.088183697979203e-7, 8.08835339730439e-7, 8.088523103750701e-7, 8.088692817318579e-7, 8.088862538008473e-7, 8.089032265820832e-7, 8.089202000756107e-7, 8.089371742814744e-7, 8.08954149199719e-7, 8.089711248303895e-7, 8.089881011735307e-7, 8.090050782291876e-7, 8.090220559974051e-7, 8.090390344782276e-7, 8.090560136717006e-7, 8.090729935778684e-7, 8.090899741967764e-7, 8.09106955528469e-7, 8.091239375729913e-7, 8.091409203303882e-7, 8.091579038007047e-7, 8.091748879839856e-7, 8.091918728802755e-7, 8.092088584896196e-7, 8.092258448120628e-7, 8.092428318476501e-7, 8.092598195964262e-7, 8.092768080584359e-7, 8.092937972337244e-7, 8.093107871223367e-7, 8.093277777243176e-7, 8.093447690397117e-7, 8.093617610685645e-7, 8.093787538109204e-7, 8.093957472668248e-7, 8.094127414363224e-7, 8.094297363194582e-7, 8.094467319162771e-7, 8.094637282268241e-7, 8.094807252511442e-7, 8.094977229892823e-7, 8.095147214412835e-7, 8.095317206071925e-7, 8.095487204870546e-7, 8.095657210809146e-7, 8.095827223888174e-7, 8.095997244108083e-7, 8.096167271469319e-7, 8.096337305972335e-7, 8.09650734761758e-7, 8.096677396405502e-7, 8.096847452336552e-7, 8.097017515411184e-7, 8.097187585629845e-7, 8.097357662992982e-7, 8.097527747501052e-7, 8.0976978391545e-7, 8.097867937953778e-7, 8.098038043899337e-7, 8.098208156991626e-7, 8.098378277231097e-7, 8.098548404618198e-7, 8.098718539153381e-7, 8.098888680837098e-7, 8.099058829669797e-7, 8.099228985651929e-7, 8.099399148783947e-7, 8.0995693190663e-7, 8.099739496499437e-7, 8.099909681083811e-7, 8.100079872819872e-7, 8.100250071708071e-7, 8.100420277748859e-7, 8.100590490942686e-7, 8.100760711290003e-7, 8.100930938791263e-7, 8.101101173446916e-7, 8.101271415257411e-7, 8.101441664223202e-7, 8.101611920344737e-7, 8.101782183622472e-7, 8.101952454056854e-7, 8.102122731648334e-7, 8.102293016397366e-7, 8.102463308304398e-7, 8.102633607369886e-7, 8.102803913594276e-7, 8.102974226978024e-7, 8.103144547521579e-7, 8.103314875225394e-7, 8.103485210089919e-7, 8.103655552115606e-7, 8.103825901302907e-7, 8.103996257652272e-7, 8.104166621164156e-7, 8.104336991839009e-7, 8.104507369677281e-7, 8.104677754679425e-7, 8.104848146845895e-7, 8.105018546177141e-7, 8.105188952673613e-7, 8.105359366335768e-7, 8.105529787164052e-7, 8.105700215158922e-7, 8.105870650320829e-7, 8.106041092650221e-7, 8.106211542147557e-7, 8.106381998813281e-7, 8.106552462647854e-7, 8.106722933651721e-7, 8.106893411825339e-7, 8.107063897169157e-7, 8.107234389683631e-7, 8.107404889369211e-7, 8.107575396226348e-7, 8.107745910255499e-7, 8.107916431457111e-7, 8.108086959831642e-7, 8.108257495379541e-7, 8.10842803810126e-7, 8.108598587997254e-7, 8.108769145067976e-7, 8.108939709313879e-7, 8.109110280735412e-7, 8.109280859333032e-7, 8.109451445107188e-7, 8.109622038058338e-7, 8.109792638186931e-7, 8.109963245493421e-7, 8.110133859978261e-7, 8.110304481641904e-7, 8.110475110484804e-7, 8.110645746507412e-7, 8.110816389710184e-7, 8.11098704009357e-7, 8.111157697658027e-7, 8.111328362404006e-7, 8.111499034331959e-7, 8.111669713442343e-7, 8.111840399735607e-7, 8.112011093212209e-7, 8.1121817938726e-7, 8.112352501717233e-7, 8.112523216746561e-7, 8.112693938961041e-7, 8.112864668361126e-7, 8.113035404947264e-7, 8.113206148719917e-7, 8.113376899679531e-7, 8.113547657826566e-7, 8.113718423161474e-7, 8.113889195684706e-7, 8.11405997539672e-7, 8.114230762297966e-7, 8.114401556388901e-7, 8.114572357669977e-7, 8.11474316614165e-7, 8.114913981804372e-7, 8.1150848046586e-7, 8.115255634704787e-7, 8.115426471943384e-7, 8.115597316374849e-7, 8.115768167999634e-7, 8.115939026818196e-7, 8.116109892830988e-7, 8.116280766038463e-7, 8.116451646441075e-7, 8.116622534039283e-7, 8.116793428833538e-7, 8.116964330824294e-7, 8.117135240012008e-7, 8.117306156397131e-7, 8.117477079980123e-7, 8.117648010761435e-7, 8.11781894874152e-7]
ys = [-342.9616708092102, -335.3745849286647, -345.4572749221692, -336.86635970696886, -345.9268092985153, -338.14800317885215, -358.55434776525357, -336.23926727934565, -340.59180548034993, -343.12458234265955, -351.0341382900673, -341.6835694576481, -339.4522681271844, -338.1324481600885, -341.5294264023907, -346.0183330559851, -335.9682378655858, -342.74908569809014, -336.8848314482484, -350.9520196760782, -343.2961356741073, -349.8667943661624, -342.7030658459354, -337.7322383588918, -343.97443974318, -339.95719143577594, -334.4994391186075, -358.2114816598766, -340.2384495429041, -343.65240618748896, -343.21006696078285, -338.5954402372411, -339.8625952272191, -352.16215161009364, -339.4165965869394, -343.85234980951054, -349.31904708484007, -341.396290942717, -346.40651310463846, -350.34189440072214, -339.5445961194263, -346.417487142057, -343.9722073604369, -339.2030301907818, -337.2527508881661, -351.04075598545427, -336.63901980223216, -343.28615876840666, -345.25427553969445, -349.11363018018045, -349.9636984685103, -339.1399231262209, -334.3767797001561, -336.53564650562134, -358.95587203990834, -335.3706595872356, -333.89747467658935, -337.6320776343807, -337.5397866697191, -334.2410460350641, -338.3917694406478, -342.8411891804036, -334.6593901062216, -334.14063820806746, -331.36288250059965, -336.96418691605146, -340.99941059278945, -336.02352263039984, -331.34399029256434, -339.1027278550681, -335.66284529786617, -333.4830471108139, -345.4421682618567, -337.0722201169764, -342.8450804849366, -334.4482084376557, -337.6218979134856, -339.84929173652677, -334.6254443936437, -334.7932908500297, -332.2663728641863, -339.83702934101586, -340.0053953211597, -334.4933319299346, -335.8885916765961, -344.02951023626326, -336.70940931499365, -347.03101748688874, -334.1382413249389, -353.92987406946736, -339.4523627671472, -334.5609226395447, -344.7494605461009, -348.2960935712747, -333.2792979252668, -336.8505377660611, -341.19748223417207, -343.0304005391244, -358.001329721902, -342.87244465952995, -335.5791996528754, -333.4285608492502, -342.0976741899734, -337.6172334991322, -337.5173099623925, -347.39801881893425, -343.1729715368193, -336.2242641627679, -333.3699307875846, -349.0657284188061, -342.34181185440127, -342.0707674721598, -340.9341506441393, -345.63318821445904, -326.9716692688177, -337.3354255743395, -335.84820320377685, -341.5308909113788, -342.0258641440872, -338.8650245191004, -336.9649495051365, -335.0227262147963, -334.1066641561218, -342.49147008194456, -334.38320670788517, -341.32126399520166, -337.6471869523513, -347.055879412814, -330.9516158230314, -334.80278211073716, -332.28076171719493, -333.22341194699476, -339.07076370160564, -334.1643050006869, -334.9232655906355, -340.7627208296723, -345.3626643306325, -343.8778420285643, -350.53583553048844, -334.7183285246281, -345.07907568070755, -336.9474642428545, -338.60218440448114, -334.74048026788915, -335.81274481793855, -336.06182038754264, -334.29854151270143, -334.9128361570578, -348.78077673092145, -338.5253283058129, -341.4167846164104, -342.65731567161, -338.4473649988148, -342.475450029427, -335.94361209451586, -337.76674553767873, -343.06255045273906, -340.86045437882376, -339.18967492976293, -341.4017974057413, -340.4990054041344, -339.5391661322082, -340.75914823167545, -336.4523061429676, -340.2595733579249, -342.26491188812787, -348.51911674731986, -345.45392405851476, -347.9262967015956, -345.845863773983, -340.720006263492, -339.40082936110036, -337.59597500653655, -339.6923260021349, -342.63488778637276, -344.5258049788669, -340.19361445600845, -352.2475550109272, -335.4471024114213, -342.6654097390832, -345.556736163386, -336.72421492035147, -345.76414742301256, -341.89831406065446, -343.4091479344779, -335.36965643586154, -353.7580933532904, -338.9136036448494, -338.30185978074735, -335.6340396499303, -336.1418594558515, -333.16207456259394, -336.50414699846795, -348.52421868612373, -351.49766827079793, -337.2069041392746, -347.65652264448903, -346.1406289085772, -337.2844562589738, -340.7320082120434, -341.56159778309024, -344.9033301440982, -342.1414157615118, -334.5952654436502, -338.3972263197865, -335.55152835252244, -335.9071515099882, -338.85760776183616, -341.87232095571846, -338.1894609049324, -334.07287726195966, -341.8673462800656, -337.7689461127478, -342.58934799044647, -356.41341044598386, -350.5860856924772, -336.0720643224041, -350.332335015199, -351.5014118763414, -336.32786489780005, -341.6837926656207, -348.28171819847046, -344.7698131028565, -358.69495294570675, -343.0856354670183, -357.19812705247875, -339.3124490746003, -354.2252637204589, -340.278028926803, -345.9335501798947, -344.8182798280542, -345.22767386493064, -342.6651725632285, -339.86758999207416, -334.64575887676017, -341.7282319873064, -342.7323049993182, -339.6235824374911, -335.3970663313048, -334.94509662525195, -335.1360518585597, -337.26920347540585, -339.1167465324222, -335.45574812721657, -337.00756009007426, -334.027647105417, -340.8062050865908, -336.566333355894, -332.0957987870263, -334.5310529787232, -337.3863841602589, -344.21237533056933, -335.7130651418955, -334.63575883710575, -335.7275763971384, -337.6073409613736, -337.22931292589686, -335.01769080565236, -335.6631606373076, -336.41495754015006, -333.5935975603944, -332.50016545772246, -338.7835349266943, -339.7724592614475, -333.33522538081, -336.0427413898935, -344.7245755943524, -336.6458324955033, -335.76218214271853, -337.3689779630844, -337.4182096123293, -335.08021789048706, -335.9915808371648, -342.25934187091946, -340.52126062902073, -342.87633854595356, -348.005038502416, -336.86083143030646, -344.27746870160496, -338.4635695115837, -344.5995826149316, -342.5636947613696, -342.91544862901833, -342.6271050606033, -338.9672299495539, -353.6669707847093, -339.5502877901448, -345.99451147038627, -338.408583591885, -340.750682411063, -338.6468084670843, -345.52331657802904, -338.4708803445892, -347.4908799213065, -347.3529005645733, -341.276323564888, -340.4678370361522, -339.69087997539225, -345.8759017416259, -341.05049578415515, -338.86418165596194, -342.2255937892023, -342.374738555136, -339.70274320556257, -346.06869935285386, -342.30453719250085, -341.0413056426672, -349.73599255262684, -328.315531375654, -340.9586488557639, -348.3778844251384, -350.69823342828533, -339.0412763865844, -342.40136517892176, -340.9451809003346, -331.43181769536, -342.22393704596067, -343.8457364245122, -338.6939726408182, -334.4824522865648, -341.3909996727719, -340.4972148100458, -338.40209730595603, -342.03814957447025, -335.6409374019987, -332.7494481272094, -333.0278102190996, -336.446750141945, -337.2786909392819, -337.7354050707598, -336.7138909627015, -344.316429170011, -333.83320883749707, -334.1444591686484, -334.34174734975363, -332.512224447328, -336.0966625244325, -334.74394133332044, -334.3681648470907, -336.4577768868517, -338.1252228366486, -334.8793844874366, -333.3435062251777, -341.3831826283607, -339.38132233663555, -335.54575829440137, -341.544627706877, -333.72760028917685, -333.50821665559073, -338.1448347471106, -333.7229953315251, -337.8690856279059, -336.77430088436375, -352.91410979406635, -333.852538676953, -337.59004718933807, -333.81881247057635, -336.30339443032597, -340.2284683558142, -332.4880517027406, -333.647701934461, -338.1604878465344, -340.28634769471245, -335.4612748386173, -347.90114150385506, -335.84719922157666, -338.94772436298183, -334.9009089379263, -332.4738012371024, -356.7828077931179, -334.09447680490325, -345.98099396306964, -337.23657867853035, -336.8615590983034, -334.0854691992264, -340.7626848541681, -337.16478034660264, -343.53509147268454, -343.0980323531619, -333.6055319036499, -339.12813357426523, -342.6557715523146, -352.67572223900515, -332.7180623402264, -338.54347588304364, -349.44228896975983, -338.6380364920533, -348.78026682368716, -334.8358823946212, -344.1468464987335, -334.4641148959695, -340.4351156160465, -354.561629305297, -354.25819864544064, -346.4590314643386, -352.4185976639877, -347.5691691079563, -338.0602349586164, -357.7345753124431, -351.3281009393022, -339.25179934939445, -340.1739107157074, -332.8695675522457, -337.2519506164668, -334.2927768951514, -357.2860029648976, -340.68908083041833, -353.4343137741488, -346.7368418734129, -348.94282761079586, -341.81502378265094, -338.38558088369444, -344.60521670537736, -342.52318776194556, -345.2586284923706, -348.82008286196844, -362.39637949266785, -342.20828833267797, -346.1922132274541, -364.2779298995933, -342.0047010408468, -344.28485423503867, -346.3236742182022, -343.40541022129264, -339.5232404428662, -342.6330880337503, -346.90151132153824, -355.43089870335564, -339.5617391278714, -346.1886694433386, -347.1835218547478, -353.604408961939, -341.9697536909207, -362.5206446623504, -341.8057177567298, -352.5698593966058, -345.13263911331603, -347.05403584888893, -345.5842261028673, -340.5462689837127, -336.3274538768759, -342.32620659616055, -338.89010920240315, -341.70408651809964, -336.5429947842623, -334.778302690103, -347.9637901032481, -346.0397003766436, -338.25925987169785, -353.661407727109, -345.1983426438063, -338.4806689188413, -334.3065983088886, -339.7438860046326, -345.5418019478389, -340.19729668341085, -338.2063046639149, -338.37566991308967, -342.6220934063426, -339.53845817433745, -335.3485750005191, -348.06664424142616, -343.092667813703, -339.5124529686998, -341.7939590745871, -339.20065281314754, -343.00696638582315, -339.2838551063499, -353.2323238485682, -338.4525765022165, -337.00891059004414, -334.94857682369036, -335.60715288075534, -355.6116443569366, -341.31753197494413, -341.75206336611757, -343.74480381010807, -339.55655177700805, -353.5125893175845, -347.05109185663963, -338.4052703527564, -344.2052341649861, -338.95481203896145, -350.7439532791542, -341.8543650992718, -335.1308905055873, -339.8729141252886, -342.9000892938399, -347.8578912217756, -345.6540769846523, -359.43437312937056, -351.1547975291637, -344.4103949799354, -348.64848311530244, -337.2315894932475, -344.5717419746146, -345.48330746503956, -344.19278744454186, -349.36962659242033, -351.85591837452677, -337.3040432224491, -338.8934638015416, -343.1627780654162, -341.43196186816346, -352.58057838517624, -344.8126471081663, -339.4994832199922, -340.44898014618815, -335.0377964655306, -336.6285591318632, -336.6384847350764, -338.59072589933044, -348.1496456032625, -340.4835302315373, -353.6358191203231, -338.3918481990289, -339.0761494525568, -341.0177111929375, -336.42217208037164, -344.5350023613074, -337.37269674835056, -336.49805180340104, -337.9657606466139, -345.0734327847583, -341.6023942561458, -333.73463216117534, -344.3092732113331, -344.29585723069545, -336.3177995579054, -348.40282686729347, -332.38426738624577, -339.25085744286156, -350.944455691176, -335.40657731339456, -356.81085998720687, -338.8599646176183, -343.48677437620836, -337.18465067299485, -334.6081930240424, -350.2866958188707, -343.08668965476846, -341.76800575775707, -347.36242816018785, -338.092245559865, -335.13492039923307, -344.42019252417145, -354.476171116809, -349.12170482088754, -346.70693762793684, -353.66589201609975, -345.0457482060366, -339.82046693484926, -336.74953842950566, -337.24418899232717, -338.8880093997321, -342.767757916911, -335.20319813049076, -337.69828964328065, -353.81425868546324, -342.6287179690852, -340.60723006276396, -339.54032402530106, -348.09804894334036, -335.78937735985954, -336.2344114840628, -330.1052974307054, -335.77788621763045, -338.88239181185094, -330.4266058350039, -337.1002740756712, -353.4024331860139, -335.28803271764207, -336.3388465649595, -333.24145469579616, -341.43590137554105, -339.6091523494273, -332.91793768241286, -327.75933034841046, -333.22757247731744, -330.6368074055347, -337.8407194975525, -335.0921168982333, -346.9137419606693, -329.5987159937809, -335.0281626017954, -339.35532461120147, -336.4281893510858, -336.47256980437584, -332.03215390907616, -329.0781447094771, -327.0734222069093, -334.23921405985567, -331.5487285524856, -344.37317118366394, -339.92132963217, -338.5838458036226, -327.5961845469287, -326.82503383078904, -331.6418877831364, -338.2426738985567, -331.11931445621616, -328.93506264892426, -329.1584048071885, -329.3189969861212, -329.8494989497894, -353.39973249850993, -338.66791305658194, -335.252250125469, -343.0323594552237, -324.2144738358089, -331.8706177642016, -333.3098164174829, -339.0003438253543, -342.69827105330825, -339.2115001981898, -338.89321165149136, -331.293476358773, -332.62198729252736, -327.9286828235684, -329.4725284166398, -340.3966355616709, -318.0202596002088, -334.37518381899633, -318.4043135972819, -328.79995302355206, -326.32845075129575, -330.61576694931483, -Inf, -328.60825850242094, -322.967387506043, -326.15882423368134, -322.11124586694444, -327.2876939691539, -322.4776606044877, -333.5057792026105, -334.9282201241847, -328.0966928068468, -329.9390017051271, -334.8134521463577, -324.125060834976, -328.59905075100863, -332.7502341643122, -330.850217890133, -336.85031000342127, -327.02613230028294, -331.4021798713537, -344.8835100912769, -325.75004201855876, -331.60566738619764, -332.4161447037021, -327.78547578967857, -326.49562883930963, -326.8194530575224, -325.7877465740336, -320.01653060040394, -334.4725008753872, -330.5409572859293, -331.8001929037694, -332.6536569412238, -342.8325326936925, -329.34725275561163, -331.3461304197321, -332.2733440255814, -334.8089456619864, -337.2052919882745, -326.35397555777854, -334.6275884861053, -339.5755200874208, -332.2478327703441, -345.74441164368636, -338.0560714532276, -334.47553232738426, -335.64695774930493, -331.6057636756372, -332.79211111580094, -336.52505646522064, -335.03345702830984, -341.9383789802523, -335.91816174144986, -339.83915513907283, -335.04312239212584, -355.707644412097, -341.34713759771705, -336.52124182589745, -337.77725540387314, -342.7134980605309, -342.9762865296212, -337.2971488249866, -335.04389462081355, -338.8592814490885, -349.5164320621765, -343.36394265678274, -334.38802515414466, -335.2316968230688, -343.208227336518, -344.9836714669882, -342.93569451641184, -344.53246576312955, -347.7612268273157, -340.8827876880375]

The number of samples is 700:

julia> length(xs), length(ys)
(700, 700)

Then, I get the following result:

julia> s = Spline1D(xs, ys);

julia> s(xs)
700-element Vector{Float64}:
 NaN
 NaN
 NaN
   ⋮
 NaN
 NaN
 NaN

Note that I am evaluating the interpolator at the sample points, so the interpolation values should be sample values, not NaNs.

I'm curious why this is happening, and if there is a workaround. Strangely, if I reduce the length of the samples, e.g., to 600, the problem disappears:

julia> s = Spline1D(xs[1:600], ys[1:600]);

julia> s(xs[1:600])  ys[1:600]
true

Citing the Dierckx Julia package

Hello!

I've used Dierckx.jl in one of my projects that I am writing a manuscript for. I have cited the original work by Dierckx, but how should I cite Dierckx.jl specifically? Is there a DOI available?

Best Regards,
Nat

MethodError: no method matching (::Spline1D)(::Float64, ::SciMLBase.NullParameters, ::Float64)

I'm still a newbie in Julia and I'm having trouble giving interpolate numbers in a form that works:

I have a 2D array of functions and their values generated from a Gaussian Random Field that I would like to do a numerical anti-derivative. The functions are smooth so I thought giving ODEProblem the interpolate function would do what I want but I'm stuck in "no method matching" land:

using Stheno
l = 0.2  # GRF parameter (see table 1)
m = 100  # Number of sensors (see table 1)
initial_condition = 0  # s(0) = 0
train_trajectories = 100  # number of functions with s
x_begin = 0.0
x_end = 1.0
x = range(x_begin, x_end; length=m)
GRF = GP(SEKernel() ∘ ScaleTransform(1/l))
u_train = transpose(rand(GRF(x, 1e-12), train_trajectories))
s_train = similar(u_train)
using Dierckx
using DifferentialEquations
for index in 1:train_trajectories
    problem = ODEProblem(Spline1D(x, u_train[index, :]), initial_condition, (x_begin, x_end))
    s_train[index] = solve(problem, reltol=1e-9, abstol=1e-9)
end

I'm getting the error: MethodError: no method matching (::Spline1D)(::Float64, ::SciMLBase.NullParameters, ::Float64)

libddierckx not defined

I recently installed 1.7, and I'm now getting the error:
ERROR: UndefVarError: libddierckx not defined Stacktrace: [1] Spline1D(x::LinRange{Float64, Int64}, y::Vector{Float64}; w::Vector{Float64}, k::Int64, s::Float64, bc::String, periodic::Bool) @ Dierckx ~/.julia/packages/Dierckx/0w6mc/src/Dierckx.jl:151 [2] top-level scope @ REPL[4]:1
when I try to use Spline1D.

Complex numbers in Spline1D

I get an "inexacterror" when using a complex array of floats for Spline1D:

ERROR: InexactError: Float64(-1690.6161529533777 - 1214.84327391387im)

my_array looks like this:

julia> my_array[:]
12340-element Array{Complex{Float64},1}:
 -1690.6161529533777 - 1214.84327391387im
  -895.4613828155627 - 2012.3699900000424im
  -981.8496071930282 - 2613.8440510838im
 -1712.4126659718233 - 2936.555315343548im
  -2492.559747350752 - 2996.238395928293im
                     ⋮
 -1837.6891112079963 + 528.5228512955363im
  -3679.040165510708 + 849.8114560880327im
  -4570.730515975646 + 789.0130974446927im
  -4250.116932137339 + 354.47021983501594im
  -3047.113151368609 - 366.1991927217247im

The code looks like this:

        T_in = 1/fs_in
        T_out = 1/fs_out

        t_tot = length(my_array[:])*T_in
        no_of_samples = round(t_tot/T_out)

        t_in = 0:T_in:(length(my_array[:])-1)*T_in
        t_out = 0:T_out:(no_of_samples-1)*T_out
        spline = Spline1D(t_in, my_array[:])   # <-------- The inexact error occurs here
        out = spline(t_out)

I works for a non-complex arrays.

`derivative` does not respect boundary condition

I'm using bc="nearest" for my 1D spline interpolator, but the derivative function is not respecting this boundary condition.
here, I'm showing that the derivative is nonzero, whereas the interpolator is flat in this region of the domain.

Screenshot 2024-06-15 at 8 34 19 AM

Installation

Hello

The installation of the package seems to be broken for Julia 1

  Building Dierckx → `~/.julia/packages/Dierckx/9SY4A/deps/build.log`
┌ Error: Error building `Dierckx`: 
│ [ Info: Downloading https://github.com/kbarbary/DierckxBuilder/releases/download/v1.0.0-1/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc8.tar.gz to /Users/mathiaslouboutin/.julia/packages/Dierckx/9SY4A/deps/usr/downloads/libddierckx.v1.0.0.x86_64-apple-darwin14-gcc8.tar.gz...
│ ERROR: LoadError: LibraryProduct(nothing, ["libddierckx"], :libddierckx, "Prefix(/Users/mathiaslouboutin/.julia/packages/Dierckx/9SY4A/deps/usr)") is not satisfied, cannot generate deps.jl!

cheers

Decrease code duplication in `ParametricSpline`

The four constructor methods for ParametricSpline are really similar and there's a lot of code repetition. It would be great for maintenance to be able to clean these up, perhaps using a "private" implementation function that the specific methods all call. cc @bshall

Two other things I noticed:

  • I don't think the code should modify the input and issue a warning if periodic is true but the start and end points don't match. The scipy version just ignores the last point if periodic is true. That seems better to me.
  • ub and ue could be united into a single argument ubounds::Tuple{Float64, Float64}. Or if they're not currently used by anyone, I would say just remove that option for now. We don't support it in the other spline types, even though it is supported in the Fortran library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.