pfocal | R Documentation |
A fast, parallel implementation of convolutions for grid-type data (matrices, rasters and other grid based objects).
pfocal( data, kernel, edge_value = 0, transform_function = "MULTIPLY", reduce_function = "SUM", mean_divider = "ONE", variance = FALSE, na.rm = NA, mp = TRUE, debug_use_r_implementation = FALSE, ... )
data |
[matrix-type] Grid to compute onto. |
kernel |
[matrix] Computation kernel (neighborhood). |
edge_value |
[numeric] Numeric value, |
transform_function |
[character] The function to apply to the
cell values covered by the kernel. For possible values, see
|
reduce_function |
[character] The function to apply to the kernel
values after the function passed in |
mean_divider |
[character] Optional, allows to specify how the
final value at each cell is divided by a value that can be function of
the intermediate data resulting of applying |
variance |
[logical] Whether to return the "variance" of the
intermediate values at each point (for more details please see
|
na.rm |
[NA OR logical] The behavior to adopt for dealing with
missing values, default to |
mp |
[logical] Whether to use the open_mp implementation,
default to |
debug_use_r_implementation |
[logical] Used for debugging purposes
whether to use the slow R implementation instead of the fast C++ code.
Default to |
... |
None used at the moment . |
Note that the memory allocation for the output is of size
sizeof(double) * ncol * nrow
and for the intermediate
values, sizeof(double) * (ncol + kernel_ncol) * (nrow + kernel_nrow/2)
.
The updated, convoluted grid.
data <- matrix(nrow = 10, ncol = 10, data = runif(10 * 10)) kernel <- matrix(1 / 9, nrow = 3, ncol = 3) pfocal(data = data, kernel = kernel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.