Evaluates the discrete B-spline basis of a given order, with respect to given design points, evaluated at arbitrary query points.
n_eval(k, xd, x, normalized = TRUE, knot_idx = NULL, N = NULL)
Order for the discrete B-spline basis. Must be >= 0.
Design points. Must be sorted in increasing order, and have length
at least k+1
.
Query points. Must be sorted in increasing order.
Should the discrete B-spline basis vectors be normalized to
attain a maximum value of 1 over the design points? The default is TRUE
.
Vector of indices, a subset of (k+1):(n-1)
where n = length(xd)
, that indicates which design points should be used as knot
points for the discrete B-splines. Must be sorted in increasing order. The
default is NULL
, which is taken to mean (k+1):(n-1)
.
Matrix of discrete B-spline evaluations at the design points. The
default is NULL
, which means that this is precomputed before constructing
the matrix of discrete B-spline evaluations at the query points. If N
is
non-NULL
, then the argument normalized
will be ignored (as this would
have only been used to construct N at the design points).
Sparse matrix of dimension length(x)
by length(knot_idx) + k + 1
.
The discrete B-spline basis functions of order \(k\), defined with
respect to design points \(x_1 < \ldots < x_n\), are denoted
\(\eta^k_1, \ldots, \eta^k_n\). For a discussion of their properties and
further references, see the help file for n_mat()
. The current function
produces a matrix of evaluations of the discrete B-spline basis at an
arbitrary sequence of query points. For each query point \(x\), this
matrix has a corresponding row with entries:
$$
\eta^k_j(x), \; j = 1, \ldots, n.
$$
Unlike the falling factorial basis, the discrete B-spline basis is not
generally available in closed-form. Therefore, the current function (unlike
h_eval()
) will first check if it should precompute the evaluations of the
discrete B-spline basis at the design points. If the argument N
is
non-NULL
, then it will use this as the matrix of evaluations at the
design points; if N
is NULL
, then it will call n_mat()
to produce
such a matrix, and will pass to this function the arguments normalized
and knot_idx
accordingly.
After obtaining the matrix of discrete B-spline evaluations at the design
points, the fast interpolation scheme from dspline_interp()
is used to
produce evaluations at the query points.
n_mat()
for constructing evaluations of the discrete B-spline
basis at the design points.