JuliaMath / JuliaMath/Dierckx.jl
Default k adapt to data length
Open
- Dominant language
- Julia
- Stars
- 173
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
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), ...
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.