innerProduct {mrct} | R Documentation |
Pairwise inner product for L^2
functions
Description
Calculate all pairwise inner products between elements from L^2
supplied to this function. The integral is approximated by the Trapezoidal rule for uniform grids:
\int_a^b f(x) dx \approx \Delta x \left( \sum_{i=1}^{N-1} f(x_i) + \frac{f(x_N) - f(x_0)}{2} \right)
whereas \{x_i \}
is an uniform grid on [a,b]
such that a = x_0 < x_1 < \ldots < x_N = b
and \Delta x
the step size, i.e. \Delta x := x_2 - x_1
.
Therefore, it is assumed that the functions are evaluated at the same, equidistant grid.
Usage
innerProduct(grid, data)
Arguments
grid |
A numeric vector of the uniform grid on which the functions are evaluated. |
data |
A numeric matrix. Each function has to be a vector stored in a column of |
Value
Numeric symmetric matrix containing the approximated pairwise inner products between the functions supplied by data
. The entry (i,j)
of the result is the inner product
between the i
-th and j
-th column of data
.
Examples
# Create orthogonal fourier basis via `fdapace` package
library(fdapace)
basis <- fdapace::CreateBasis(K = 10,
type = "fourier")
iP <- innerProduct(grid = seq(0, 1, length.out = 50), # default grid in CreateBasis()
data = basis)
round(iP,3)
# Since the basis is orthogonal, the resulting matrix will be the identity matrix.