View source: R/Laplacian_GridOperator.R
1 | Laplacian_GridOperator(var = "x", grid_dataframe, h = 1)
|
var |
|
grid_dataframe |
|
h |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (var = "x", grid_dataframe, h = 1)
{
DeltaX = mean(diff(sort(unique(grid_dataframe[, "x"]))))
DeltaY = mean(diff(sort(unique(grid_dataframe[, "y"]))))
d <- approx_equals(as.matrix(dist(grid_dataframe)), c(x = DeltaX,
y = DeltaY)[var]) * approx_equals(as.matrix(dist(grid_dataframe[[var]])),
c(x = DeltaX, y = DeltaY)[var])
diag(d) <- -colSums(d)
as(d/h^2, "dsCMatrix")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.