JuliaMath / JuliaMath/Dierckx.jl

Default k adapt to data length

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.