kbarbary / Dierckx.jl

Julia package for 1-d and 2-d splines
Other
156 stars 30 forks source link

Partial derivatives for 2D splines #88

Closed jishnub closed 1 year ago

jishnub commented 2 years ago

~A bunch of whitespace changes are introduced by the VScode plugin, sorry about these, but hopefully these will improve readability.~

The main change introduced here is the ability to compute partial derivatives of 2D splines.

julia> x = Vector{Float64}(1:4); y = Vector{Float64}(1:5); z = (x.^2) * (y.^3)'
4×5 Matrix{Float64}:
  1.0    8.0   27.0    64.0   125.0
  4.0   32.0  108.0   256.0   500.0
  9.0   72.0  243.0   576.0  1125.0
 16.0  128.0  432.0  1024.0  2000.0

julia> s = Spline2D(x, y, z);

julia> derivative(s, 1, 1, nuy=1, nux=0) # 3x^2y^2
3.000000000000028

julia> derivative(s, 1, 1, nuy=0, nux=1) # 2xy^3
1.9999999999999887

julia> derivative(s, 1, 1, nuy=1, nux=1) # 6xy^2
6.000000000000547

~I've also taken the liberty to refactor the tests by introducing testsets.~

jishnub commented 2 years ago

@kbarbary could you have a look at this?

jishnub commented 2 years ago

Gentle bump cc @kaarthiksundar

jishnub commented 2 years ago

@moelf would you mind taking a look at this?

Moelf commented 2 years ago

looks fine to me but again I'm not super familiar with the code base

jishnub commented 1 year ago

I've reverted the whitespace and testset changes to make this PR much easier to review. I wonder who would be the right person to approach for this?

kaarthiksundar commented 1 year ago

@jishnub Tagged a new version. Sorry got busy last week.

jishnub commented 1 year ago

Thanks!