kbarbary / Dierckx.jl

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

Return NaN #86

Closed dmoored4 closed 3 years ago

dmoored4 commented 3 years ago

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?

kbarbary commented 3 years ago

Huh, I'm not sure. This isn't a feature of the Fortran library, and although this would be relatively minor, I'm hesitant to start adding pure-Julia features here. Effort adding pure-Julia features would probably be better spent in a package like Interpolations.jl.

It should be relatively easy for users to "add on" this functionality themselves by setting values outside the boundary knots (get_knots(spl)[[1,end]]) to NaN when evaluating.

I guess it depends whether this would be a widely used feature, which is a little hard to get a feeling for.

dmoored4 commented 3 years ago

Ok thanks for the rec to look towards Interpolations for Julia features. Makes sense that you want to keep this as.