Laplacian_GridOperator: Calculate Laplacian operator on a grid

Usage Arguments Examples

View source: R/Laplacian_GridOperator.R

Usage

1
Laplacian_GridOperator(var = "x", grid_dataframe, h = 1)

Arguments

var
grid_dataframe
h

Examples

 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")
  }

James-Thorson/movement_tools documentation built on May 7, 2019, 10:19 a.m.