Computes the basis mapping matrix between a function space on a mesh, and locations.
fm_basis(x, ..., full = FALSE)# S3 method for default
fm_basis(x, ..., full = FALSE)
# S3 method for fm_mesh_1d
fm_basis(x, loc, weights = NULL, derivatives = NULL, ..., full = FALSE)
# S3 method for fm_mesh_2d
fm_basis(x, loc, weights = NULL, derivatives = NULL, ..., full = FALSE)
# S3 method for fm_mesh_3d
fm_basis(x, loc, weights = NULL, ..., full = FALSE)
# S3 method for fm_lattice_2d
fm_basis(x, loc, weights = NULL, ..., full = FALSE)
# S3 method for fm_lattice_Nd
fm_basis(x, loc, weights = NULL, ..., full = FALSE)
# S3 method for fm_tensor
fm_basis(x, loc, weights = NULL, ..., full = FALSE)
# S3 method for matrix
fm_basis(x, ok = NULL, weights = NULL, ..., full = FALSE)
# S3 method for Matrix
fm_basis(x, ok = NULL, weights = NULL, ..., full = FALSE)
# S3 method for list
fm_basis(x, weights = NULL, ..., full = FALSE)
# S3 method for fm_basis
fm_basis(x, ..., full = FALSE)
# S3 method for fm_evaluator
fm_basis(x, ..., full = FALSE)
A sparseMatrix
object (if full = FALSE
), or a fm_basis
object
(if full = TRUE
or isTRUE(derivatives)
). The fm_basis
object contains
at least the projection matrix A
and logical vector ok
; If x_j
denotes the latent basis coefficient for basis function j
, the field is
defined as u(loc_i)=sum_j A_ij x_j
for all i
where ok[i]
is TRUE
,
and u(loc_i)=0.0
where ok[i]
is FALSE
.
An function space object, or other supported object
(matrix
, Matrix
, list
)
Passed on to submethods
logical; if TRUE
, return a fm_basis
object, containing at
least a projection matrix A
and logical vector ok
indicating which
evaluations are valid. If FALSE
, return only the projection matrix A
.
Default is FALSE
.
A location/value information object (numeric
, matrix
, sf
,
fm_bary
, etc, depending on the class of x
)
Optional weight vector to apply (from the left, one weight for each row of the basis matrix)
If non-NULL and logical, include derivative matrices
in the output. Forces full = TRUE
.
numerical of length NROW(x)
, indicating which rows of x
are
valid/successful basis evaluations. If NULL
, inferred as
rep(TRUE, NROW(x))
.
fm_basis(fm_mesh_1d)
: If derivatives=TRUE
, the fm_basis
object contains
additional derivative weight matrices, d1A
and d2A
, du/dx(loc_i)=sum_j dx_ij w_i
.
fm_basis(fm_mesh_2d)
: If derivatives=TRUE
, additional derivative weight
matrices are included in the full=TRUE
output: Derivative weight matrices
dx
, dy
, dz
; du/dx(loc_i)=sum_j dx_ij w_i
, etc.
fm_basis(fm_mesh_3d)
: fm_mesh_3d
basis functions.
fm_basis(fm_lattice_2d)
: fm_lattice_2d
bilinear basis functions.
fm_basis(fm_lattice_Nd)
: fm_lattice_Nd
multilinear basis functions.
fm_basis(fm_tensor)
: Evaluates a basis matrix for a fm_tensor
function
space.
fm_basis(matrix)
: Creates a new fm_basis
object with elements A
and
ok
, from a pre-evaluated basis matrix, including optional additional
elements in the ...
arguments. If a ok
is NULL
, it is inferred as
rep(TRUE, NROW(x))
, indicating that all rows correspond to successful
basis evaluations. If full = FALSE
,
returns the matrix unchanged.
fm_basis(Matrix)
: Creates a new fm_basis
object with elements A
and
ok
, from a pre-evaluated basis matrix, including optional additional
elements in the ...
arguments. If a ok
is NULL
, it is inferred as
rep(TRUE, NROW(x))
, indicating that all rows correspond to successful
basis evaluations. If full = FALSE
,
returns the matrix unchanged.
fm_basis(list)
: Creates a new fm_basis
object from a plain list
containing at least an element A
. If an ok
element is missing,
it is inferred as rep(TRUE, NROW(x$A))
. If full = FALSE
,
extracts the A
matrix.
fm_basis(fm_basis)
: If full
is TRUE
, returns x
unchanged, otherwise
returns the A
matrix contained in x
.
fm_basis(fm_evaluator)
: Extract fm_basis
information from an fm_evaluator
object. If full = FALSE
, returns the A
matrix contained in the
fm_basis
object.
fm_raw_basis()
# Compute basis mapping matrix
dim(fm_basis(fmexample$mesh, fmexample$loc))
print(fm_basis(fmexample$mesh, fmexample$loc, full = TRUE))
# From precomputed `fm_bary` information:
bary <- fm_bary(fmexample$mesh, fmexample$loc)
print(fm_basis(fmexample$mesh, bary, full = TRUE))
Run the code above in your browser using DataLab