Skip to content

Commit

Permalink
Use newer JLL with updated upstream source code
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Jan 14, 2025
1 parent b5f9b37 commit e6607ac
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.3'
- 'min'
- '1'
- 'nightly'
os:
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name = "Dierckx"
uuid = "39dd38d3-220a-591b-8e3c-4c3a8c710a94"
repo = "https://github.com/kbarbary/Dierckx.jl.git"
version = "0.5.3"
version = "0.5.4"

[deps]
Dierckx_jll = "cd4c43a9-7502-52ba-aa6d-59fb2a88580b"

[compat]
Dierckx_jll = "0.0.1, 0.1"
julia = "1.3"
Dierckx_jll = "0.2"
julia = "1.6"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
142 changes: 91 additions & 51 deletions src/Dierckx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,28 +148,45 @@ function Spline1D(x::AbstractVector, y::AbstractVector;
iwrk = Vector{Int32}(undef, nest)

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
0, m, xin, yin, win, xin[1], xin[end], k, Float64(s),
nest, n, t, c, fp, wrk, lwrk, iwrk, ier)
@ccall libddierckx.curfit_(
0::Ref{Int32},
m::Ref{Int32},
xin::Ref{Float64},
yin::Ref{Float64},
win::Ref{Float64},
xin[1]::Ref{Float64},
xin[end]::Ref{Float64},
k::Ref{Int32},
Float64(s)::Ref{Float64},
nest::Ref{Int32},
n::Ref{Int32},
t::Ref{Float64},
c::Ref{Float64},
fp::Ref{Float64},
wrk::Ref{Float64},
lwrk::Ref{Int32},
iwrk::Ref{Int32},
ier::Ref{Int32},
)::Nothing
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
0, m, xin, yin, win, k, Float64(s), nest, n, t, c,
fp, wrk, lwrk, iwrk, ier)
@ccall libddierckx.percur_(
0::Ref{Int32},
m::Ref{Int32},
xin::Ref{Float64},
yin::Ref{Float64},
win::Ref{Float64},
k::Ref{Int32},
Float64(s)::Ref{Float64},
nest::Ref{Int32},
n::Ref{Int32},
t::Ref{Float64},
c::Ref{Float64},
fp::Ref{Float64},
wrk::Ref{Float64},
lwrk::Ref{Int32},
iwrk::Ref{Int32},
ier::Ref{Int32},
)::Nothing
end

ier[] <= 0 || error(_fit1d_messages[ier[]])
Expand Down Expand Up @@ -222,28 +239,45 @@ function Spline1D(x::AbstractVector, y::AbstractVector,
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, -1.0,
n, n, t, c, fp, wrk, lwrk, iwrk, ier)
@ccall libddierckx.curfit_(
(-1)::Ref{Int32},
m::Ref{Int32},
xin::Ref{Float64},
yin::Ref{Float64},
win::Ref{Float64},
xin[1]::Ref{Float64},
xin[end]::Ref{Float64},
k::Ref{Int32},
(-1.0)::Ref{Float64},
n::Ref{Int32},
n::Ref{Int32},
t::Ref{Float64},
c::Ref{Float64},
fp::Ref{Float64},
wrk::Ref{Float64},
lwrk::Ref{Int32},
iwrk::Ref{Int32},
ier::Ref{Int32},
)::Nothing
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, -1.0, n, n, t, c,
fp, wrk, lwrk, iwrk, ier)
@ccall libddierckx.percur_(
(-1)::Ref{Int32},
m::Ref{Int32},
xin::Ref{Float64},
yin::Ref{Float64},
win::Ref{Float64},
k::Ref{Int32},
(-1.0)::Ref{Float64},
n::Ref{Int32},
n::Ref{Int32},
t::Ref{Float64},
c::Ref{Float64},
fp::Ref{Float64},
wrk::Ref{Float64},
lwrk::Ref{Int32},
iwrk::Ref{Int32},
ier::Ref{Int32},
)::Nothing
end

ier[] <= 0 || error(_fit1d_messages[ier[]])
Expand All @@ -263,9 +297,10 @@ function _evaluate(t::Vector{Float64}, c::Vector{Float64}, k::Int,
ccall((:splev_, libddierckx), Nothing,
(Ref{Float64}, Ref{Int32},
Ref{Float64}, Ref{Int32},
Ref{Int32},
Ref{Float64}, Ref{Float64}, Ref{Int32},
Ref{Int32}, Ref{Int32}),
t, length(t), c, k, xin, y, m, bc, ier)
t, length(t), c, length(c), k, xin, y, m, bc, ier)

ier[] == 0 || error(_eval1d_messages[ier[]])
return y
Expand All @@ -279,9 +314,10 @@ function _evaluate(t::Vector{Float64}, c::Vector{Float64}, k::Int,
ccall((:splev_, libddierckx), Nothing,
(Ref{Float64}, Ref{Int32},
Ref{Float64}, Ref{Int32},
Ref{Int32},
Ref{Float64}, Ref{Float64}, Ref{Int32},
Ref{Int32}, Ref{Int32}),
t, length(t), c, k, Float64(x), y, 1, bc, ier)
t, length(t), c, length(c), k, Float64(x), y, 1, bc, ier)

ier[] == 0 || error(_eval1d_messages[ier[]])
return y[]
Expand All @@ -306,11 +342,12 @@ function _derivative(t::Vector{Float64}, c::Vector{Float64}, k::Int,
ier = Ref{Int32}(0)
ccall((:splder_, libddierckx), Nothing,
(Ref{Float64}, Ref{Int32}, # t, n
Ref{Float64}, Ref{Int32}, # c, k
Ref{Float64}, Ref{Int32}, # c, nc
Ref{Int32}, # k
Ref{Int32}, # nu
Ref{Float64}, Ref{Float64}, Ref{Int32}, # x, y, m
Ref{Int32}, Ref{Float64}, Ref{Int32}), # e, wrk, ier
t, n, c, k, nu, x, y, m, bc, wrk, ier)
t, n, c, length(c), k, nu, x, y, m, bc, wrk, ier)
ier[] == 0 || error(_eval1d_messages[ier[]])
return y
end
Expand All @@ -323,11 +360,12 @@ function _derivative(t::Vector{Float64}, c::Vector{Float64}, k::Int,
ier = Ref{Int32}(0)
ccall((:splder_, libddierckx), Nothing,
(Ref{Float64}, Ref{Int32}, # t, n
Ref{Float64}, Ref{Int32}, # c, k
Ref{Float64}, Ref{Int32}, # c, nc
Ref{Int32}, # k
Ref{Int32}, # nu
Ref{Float64}, Ref{Float64}, Ref{Int32}, # x, y, m
Ref{Int32}, Ref{Float64}, Ref{Int32}), # e, wrk, ier
t, n, c, k, nu, Float64(x), y, 1, bc, wrk, ier)
t, n, c, length(c), k, nu, Float64(x), y, 1, bc, wrk, ier)
ier[] == 0 || error(_eval1d_messages[ier[]])
return y[]
end
Expand Down Expand Up @@ -355,9 +393,10 @@ function _integrate(t::Vector{Float64}, c::Vector{Float64}, k::Int,
ccall((:splint_, libddierckx), Float64,
(Ref{Float64}, Ref{Int32},
Ref{Float64}, Ref{Int32},
Ref{Int32},
Ref{Float64}, Ref{Float64},
Ref{Float64}),
t, n, c, k,
t, n, c, length(c), k,
Float64(a), Float64(b), wrk)
end

Expand All @@ -376,10 +415,11 @@ function roots(spline::Spline1D; maxn::Integer=8)
ier = Vector{Int32}(undef, 1)
ccall((:sproot_, libddierckx), Nothing,
(Ref{Float64}, Ref{Int32}, # t, n
Ref{Float64}, Ref{Float64}, # c, zeros
Ref{Float64}, Ref{Int32}, # c, nc
Ref{Float64}, # zeros
Ref{Int32}, Ref{Int32}, # mest, m
Ref{Int32}), # ier
spline.t, n, spline.c, zeros,
spline.t, n, spline.c, length(spline.c), zeros,
maxn, m, ier)

if ier[1] == 0
Expand Down

0 comments on commit e6607ac

Please sign in to comment.