Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explanation of requirements for spline parameters in RQSpline docs #27

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/rqspline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ Fields:
- three-dimensional arrays of the shape `K+1 x n_dims x n_samples`, representing a set of splines for different
dimensions and input samples.

The spline is continued with a linear function of slope one beyond the first
and last knot, so the first and last entry of dYdX should be one if the spline
is indended to be used at this extended range.
Requirements for the fields:

Each spline is continued with the identity function beyond its first and last knot.
So to ensure the continuity and differentiability of the splines, the first and last knots must lie on the
diagonal through 0, and the derivatives at these knots must be 1.
Formally:
For parameter vectors `pX[1] == pY[1]` and `pX[end] == pY[end]` and `dYdX[1] == dYdX[end] == 1` must hold.
For 3 dimensional parameter arrays `pX[1,:,:] == pY[1,:,:]` and `pX[end,:,:] == pY[end,:,:]` and
`dYdX[1,:,:] .== dYdX[end,:,:] .== 1` must be true.


`RQSpline` supports the InverseFunctions, ChangesOfVariables, and Functors
APIs.
Expand Down Expand Up @@ -215,7 +222,6 @@ end
pY::AbstractArray{<:Real},
dYdX::AbstractArray{<:Real}
)

i, j = @index(Global, NTuple)

K = size(pX, 1) - 1
Expand Down Expand Up @@ -321,7 +327,6 @@ function rqs_inverse(
pY::AbstractArray{<:Real,3},
dYdX::AbstractArray{<:Real,3}
)

compute_unit = get_compute_unit(x)
backend = ka_backend(compute_unit)
kernel! = rqs_inverse_kernel!(backend, _ka_threads(backend)...)
Expand Down
Loading