View source: R/matrix_evaluation.R
n_eval | R Documentation |
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)
k |
Order for the discrete B-spline basis. Must be >= 0. |
xd |
Design points. Must be sorted in increasing order, and have length
at least |
x |
Query points. Must be sorted in increasing order. |
normalized |
Should the discrete B-spline basis vectors be normalized to
attain a maximum value of 1 over the design points? The default is |
knot_idx |
Vector of indices, a subset of |
N |
Matrix of discrete B-spline evaluations at the design points. The
default is |
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.
Sparse matrix of dimension length(x)
by length(knot_idx) + k + 1
.
n_mat()
for constructing evaluations of the discrete B-spline
basis at the design points.
xd = 1:10 / 10
x = 1:9 / 10 + 0.05
n_mat(2, xd, knot_idx = c(3, 5, 7))
n_eval(2, xd, x, knot_idx = c(3, 5, 7))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.