Closed rayqu1126 closed 9 months ago
Hi! Agreed with @rayqu1126 - thank you for providing this package! It's very nice to have the capability to work with periodic B-splines bases.
To clarify, we were wondering if there was existing functionality to compute an array whose entries are
$b_{i} = B_i(x)$
where $B_i(x)$ is a single Bspline basis function evaluated at some single point $x$.
From what we could see from the docs, evaluate_all
and PeriodicBSplineBasis
return the evaluation only of B-spline bases which are supported near the evaluation point.
Update: I think we have it now. evaluate
is what we were looking for.
For reference, this is
function BsplineVandermonde(N, K, x)
bspline_basis = PeriodicBSplineBasis(BSplineOrder(N+1), range(-1, 1, length=K+1))
return hcat([evaluate(bspline_basis, i, x) for i in 0:(N+K-1)]...)
end
which allows us to generate the following plot via
x = LinRange(-1,1,500)
V = BsplineVandermonde(3, 10, x)
scatter(x, V, legend=false)
@rayqu1126 I think we can close this now
Hi,
@jlchan and I wonder if there is an easy way to construct a generalized Vandermonde whose columns correspond to evaluations of global Bspline bases at given points.
Right now we build
BsplineVandermonde(N, K, x) = hcat(PeriodicBSplineBasis(BSplineOrder(N+1), range(-1, 1, length=K+1))(x)[2]...) BsplineVandermonde(N, K, x::AbstractVector) = vcat([BsplineVandermonde(N, K, xi) for xi in x]...)
but this only returns the evaluations of local Bspline bases, as you can see from this plotx = LinRange(-1,1,500); V = BsplineVandermonde(4, 8, x); scatter(x, V[:, 1], leg=false)
.Thank you for providing this useful package and your help!