Computes the basis mapping matrix between a function space on a mesh, and locations.
Usage
fm_basis(x, ...)
# S3 method for default
fm_basis(x, loc, ...)
# S3 method for fm_mesh_1d
fm_basis(x, loc, weights = NULL, derivatives = NULL, ...)
# S3 method for fm_mesh_2d
fm_basis(x, loc, weights = NULL, derivatives = NULL, ...)
# S3 method for inla.mesh.1d
fm_basis(x, loc, ...)
# S3 method for inla.mesh
fm_basis(x, loc, ...)
# S3 method for fm_evaluator
fm_basis(x, ...)
# S3 method for fm_tensor
fm_basis(x, loc, weights = NULL, ...)
Arguments
- x
An object supported by the
fm_evaluator()
class- ...
Currently unused
- loc
A set of points of a class supported by
fm_evaluator(x, loc = loc)
- weights
Optional weight vector to apply (from the left, one weight for each row of the basis matrix)
- derivatives
If non-NULL and logical, return a list, optionally including derivative matrices.
Value
A sparseMatrix
For fm_mesh_1d
, a matrix, or if derivatives
is TRUE
,
a list with elements
- A
The projection matrix,
u(loc_i)=sum_j A_ij w_i
- d1A, d2A
Derivative weight matrices,
du/dx(loc_i)=sum_j dx_ij w_i
, etc.
For fm_mesh_2d
, a matrix, or if derivatives
is TRUE
,
a list with elements
- A
The projection matrix,
u(loc_i)=sum_j A_ij w_i
- dx, dy, dz
Derivative weight matrices,
du/dx(loc_i)=sum_j dx_ij w_i
, etc.
For fm_tensor
, a matrix
Examples
# Compute basis mapping matrix
str(fm_basis(fmexample$mesh, fmexample$loc))
#> Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
#> ..@ i : int [1:30] 3 1 7 8 5 0 6 4 2 3 ...
#> ..@ p : int [1:299] 0 0 0 0 0 0 0 0 0 0 ...
#> ..@ Dim : int [1:2] 10 298
#> ..@ Dimnames:List of 2
#> .. ..$ : NULL
#> .. ..$ : NULL
#> ..@ x : num [1:30] 0.041 0.3065 0.6899 0.4015 0.0253 ...
#> ..@ factors : list()