innerprod.im {lacunaritycovariance} | R Documentation |
Inner Product of Two Functions Represented as Images
Description
Given two functions, f and g, that map from 2D space to 1D, and values of f and g represented as im
objects
then innerprod.im
computes the (function space) inner product
\int f(v) g(v) dv.
Usage
innerprod.im(
A,
B,
outsideA = NA,
outsideB = NA,
na.replace = TRUE,
method = "cubature"
)
Arguments
A |
An |
B |
An |
outsideA |
The value of |
outsideB |
The value of |
na.replace |
Logical. If TRUE NA values in |
method |
Either "cubature" or "harmonisesum". The former uses |
Details
This function uses the package cubature to integrate the multiple of the two images. If cubature is not available then it harmonises the two input images, multiplies them together and returns the
integral of the resulting image.
outsideA
and outsideB
are used to determine result if the inner product requires
values outside the domain of A or B. For example if outsideA=0
and the
domain of B
is larger than A
's domain then the inner product
can still be computed. However if A
is NA
outside (e.g. not
known/not provided) and the domain of B
is larger than A
's
domain then the inner product can not be computed and the returned value is NA
The harmonisesum
method appears to perform well when used by gblcc()
, but produces numerical artefacts when used by gblc()
and gblg()
. The cubature
method takes longer to compute and is more accurate for functions (A or B) that are non-zero for large vectors. This makes it suitable for use by gblc()
and gblg()
.
Value
If the inner product can be computed then returns sum(A
* B
), otherwise returns NA
.
Examples
xi <- heather$coarse
covar <- plugincvc(xi, Frame(xi))
B <- setcov(square(1))
innerprod.im(covar, B, outsideB = 0)