Methods wrapping pfocal to implement common kernel computations with default argument values.

pfocal_fast_gaussian_radius(
  data,
  vertical_radius,
  vertical_sd = 1,
  horizontal_radius = vertical_radius,
  horizontal_sd = vertical_sd,
  tail_included = TRUE,
  na.rm = NA,
  mp = TRUE,
  debug_use_r_implementation = FALSE,
  ...,
  transform_function = "MULTIPLY",
  reduce_function = "SUM",
  mean_divider = "ONE",
  variance = FALSE
)

pfocal_fast_gaussian_confidence(
  data,
  vertical_r0 = 0.05,
  vertical_sd = 1,
  horizontal_r0 = vertical_r0,
  horizontal_sd = vertical_sd,
  tail_included = TRUE,
  na.rm = NA,
  mp = TRUE,
  debug_use_r_implementation = FALSE,
  ...,
  transform_function = "MULTIPLY",
  reduce_function = "SUM",
  mean_divider = "ONE",
  variance = FALSE
)

pfocal_fast_binomial(
  data,
  vertical_radius,
  horizontal_radius = vertical_radius,
  na.rm = NA,
  mp = TRUE,
  debug_use_r_implementation = FALSE,
  ...,
  transform_function = "MULTIPLY",
  reduce_function = "SUM",
  mean_divider = "ONE",
  variance = FALSE
)

pfocal_fast_abs_rectangle(
  data,
  height,
  width = height,
  value = 1,
  na.rm = NA,
  mp = TRUE,
  debug_use_r_implementation = FALSE,
  ...,
  transform_function = "MULTIPLY",
  reduce_function = "SUM",
  mean_divider = "ONE",
  variance = FALSE
)

pfocal_fast_separated(
  data,
  kernel_list,
  na.rm = NA,
  mp = TRUE,
  debug_use_r_implementation = FALSE,
  ...,
  transform_function = "MULTIPLY",
  reduce_function = "SUM",
  mean_divider = "ONE",
  variance = FALSE
)

Arguments

data

[matrix-type] Grid to compute onto.

vertical_radius

[numeric] The kernel's radius in the vertical dimension.

vertical_sd

[numeric] The kernel's standard deviation in the vertical dimension.

horizontal_radius

[numeric] The kernel's radius in the horizontal dimension.

horizontal_sd

[numeric] The kernel's standard deviation in the horizontal dimension.

tail_included

[logical] Whether or not to include the kernel tail.

na.rm

[NA OR logical] The behavior to adopt for dealing with missing values, default to NA (faster option). For possible values see pfocal_info_nan_policy().

mp

[logical] Whether to use the open_mp implementation, default to TRUE.

debug_use_r_implementation

[logical] Used for debugging purposes whether to use the slow R implementation instead of the fast C++ code. Default to FALSE.

...

None used at the moment .

transform_function

[character] The function to apply to the cell values covered by the kernel. For possible values, see pfocal_info_transform(). Default to "MULTIPLY".

reduce_function

[character] The function to apply to the kernel values after the function passed in transform_function has been applied (the function that summarize the data). For possible values, see pfocal_info_reduce(). Default to "SUM".

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 transform_function. For possible values, see pfocal_info_mean_divisor(). Default to "ONE" (for no division).

variance

[logical] Whether to return the "variance" of the intermediate values at each point (for more details please see pfocal_info_variance()). Default to FALSE (just returns the value at each point).

vertical_r0

[numeric] The kernel's r0 (exponential) in the vertical dimension.

horizontal_r0

[numeric] The kernel's r0 (exponential) in the horizontal dimension.

height

[numeric] For rectangular kernels, the height of the rectangle.

width

[numeric] For rectangular kernels, the width of the rectangle.

value

[numeric] For single value matrices, the value.

kernel_list

[list] A list of kernels computed from functions in kernel-gaussian, kernel-binomial, kernel-circular, kernel-distance, kernel-exponential.

Value

The updated, convoluted grid.

Examples


data <- matrix(nrow = 10, ncol = 10, data = runif(10 * 10))

pfocal_fast_gaussian_radius(data, vertical_radius = 2)
#>            [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#>  [1,] 0.2037884 0.3213302 0.3484313 0.3277822 0.3370171 0.3501630 0.3417314
#>  [2,] 0.2968669 0.4385037 0.4515875 0.4157818 0.4400278 0.4615987 0.4342166
#>  [3,] 0.3563963 0.4977435 0.4889116 0.4504363 0.4897178 0.5150800 0.4756454
#>  [4,] 0.3926797 0.5433344 0.5410161 0.5096015 0.5535973 0.5783365 0.5221052
#>  [5,] 0.4017722 0.5450283 0.5317762 0.5068147 0.5461232 0.5427943 0.4638523
#>  [6,] 0.3823605 0.5085625 0.5058371 0.5043472 0.5412794 0.5323970 0.4571393
#>  [7,] 0.3449024 0.4736192 0.4911254 0.5043592 0.5293622 0.4985115 0.4240218
#>  [8,] 0.2969895 0.4194214 0.4485857 0.4680571 0.4862965 0.4518455 0.3882692
#>  [9,] 0.2336471 0.3339958 0.3640227 0.3874910 0.4023802 0.3695134 0.3289458
#> [10,] 0.1722402 0.2506730 0.2815493 0.2980755 0.3091493 0.2849763 0.2574960
#>            [,8]      [,9]     [,10]
#>  [1,] 0.3253047 0.3027927 0.2289512
#>  [2,] 0.3945328 0.3600111 0.2745244
#>  [3,] 0.4222794 0.3732704 0.2788738
#>  [4,] 0.4430457 0.3950291 0.3120836
#>  [5,] 0.3863960 0.3542386 0.2888055
#>  [6,] 0.3811647 0.3604174 0.3085861
#>  [7,] 0.3713567 0.3686478 0.3180903
#>  [8,] 0.3525139 0.3602461 0.3137794
#>  [9,] 0.3269247 0.3379526 0.2815469
#> [10,] 0.2675898 0.2840355 0.2359983
pfocal_fast_gaussian_confidence(data)
#>            [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#>  [1,] 0.1990318 0.3665853 0.4383450 0.4285291 0.4267364 0.4442226 0.4482604
#>  [2,] 0.3232258 0.5345485 0.5814989 0.5339060 0.5559811 0.5903896 0.5808979
#>  [3,] 0.4114257 0.5739675 0.5567914 0.4959427 0.5447699 0.5778625 0.5391027
#>  [4,] 0.4526075 0.5538091 0.4914838 0.4380256 0.4899085 0.5045676 0.4300480
#>  [5,] 0.4460509 0.5484887 0.4916692 0.4576359 0.5162897 0.5341608 0.4431497
#>  [6,] 0.3770550 0.5182050 0.5198934 0.5239799 0.5783464 0.5934281 0.5115394
#>  [7,] 0.3155445 0.4825252 0.5434937 0.5790477 0.5950492 0.5555621 0.4715475
#>  [8,] 0.3058970 0.4482707 0.5054797 0.5460578 0.5315003 0.4421622 0.3632187
#>  [9,] 0.2808899 0.3808087 0.4103282 0.4358099 0.4391175 0.3826849 0.3423018
#> [10,] 0.1984051 0.2733406 0.2908748 0.3012246 0.3338568 0.3282095 0.3149590
#>            [,8]      [,9]     [,10]
#>  [1,] 0.4198900 0.3861318 0.2990728
#>  [2,] 0.5579763 0.5133565 0.3779297
#>  [3,] 0.5084469 0.4656602 0.3400550
#>  [4,] 0.3633856 0.3283006 0.2538598
#>  [5,] 0.3231501 0.2635955 0.2165727
#>  [6,] 0.3818111 0.3167563 0.2700567
#>  [7,] 0.3920750 0.3932446 0.3609458
#>  [8,] 0.3604449 0.4244311 0.3923807
#>  [9,] 0.3824513 0.4299160 0.3595204
#> [10,] 0.3444507 0.3393885 0.2530941
pfocal_fast_binomial(data, vertical_radius = 2)
#>            [,1]      [,2]      [,3]      [,4]     [,5]     [,6]      [,7]
#>  [1,]  51.21721  93.61974 112.61676 110.05143 108.8276 113.7827 114.40359
#>  [2,]  83.73526 136.97060 149.52662 139.07172 142.6422 151.9898 150.49629
#>  [3,] 106.06762 147.75925 143.21583 128.96525 138.4134 147.1281 138.61982
#>  [4,] 116.68960 143.44432 126.57530 113.34871 125.3452 130.0364 111.72939
#>  [5,] 113.70536 139.93774 125.49036 116.86212 131.2405 136.7251 113.65845
#>  [6,]  96.59483 132.76589 134.77134 135.08588 148.4630 152.6401 130.23797
#>  [7,]  81.20602 123.45056 140.63247 148.73632 152.5627 142.5470 119.24482
#>  [8,]  77.76210 114.35766 131.23957 140.47552 136.4709 114.5217  93.54646
#>  [9,]  71.87572  98.50778 107.16722 113.38752 113.2874  98.7214  88.08742
#> [10,]  50.53405  69.47110  73.53357  76.89311  83.4746  82.2083  79.99631
#>            [,8]      [,9]     [,10]
#>  [1,] 108.57381  99.54727  75.65104
#>  [2,] 144.82378 132.95883  96.95206
#>  [3,] 130.40316 120.02148  87.00879
#>  [4,]  93.77913  84.22711  64.14045
#>  [5,]  83.10914  67.40601  53.95483
#>  [6,]  97.57745  81.14972  67.81112
#>  [7,] 100.67340 100.79348  90.56069
#>  [8,]  94.59862 110.93604 100.72536
#>  [9,]  98.55055 111.32726  92.21899
#> [10,]  86.87624  86.91527  64.23975
pfocal_fast_abs_rectangle(data, height = 2)
#>            [,1]      [,2]     [,3]     [,4]     [,5]     [,6]      [,7]
#>  [1,] 0.1249412 0.7550335 1.199986 1.392943 1.433133 1.137284 1.5250813
#>  [2,] 0.2338190 1.7307940 3.025352 2.527497 2.238447 2.393827 2.6153181
#>  [3,] 0.7499437 2.4197405 3.430852 2.079934 1.880440 3.141925 2.6738139
#>  [4,] 1.4474709 2.5729632 2.256766 1.416771 1.585113 2.481064 1.8162124
#>  [5,] 1.6995428 2.7277420 2.092657 1.363499 1.458157 2.098473 1.5833450
#>  [6,] 1.2624727 2.8346339 2.380640 1.521370 2.002935 2.742518 2.6218889
#>  [7,] 0.5134294 1.8284504 2.222239 2.057106 2.351290 2.614699 2.8648909
#>  [8,] 0.4900662 1.8619650 2.404713 2.494751 2.972497 2.348727 1.7891395
#>  [9,] 0.9334604 2.0073940 1.585447 1.786554 2.313589 1.502442 0.7458269
#> [10,] 0.9002515 1.5337510 1.605760 1.466114 1.562905 2.090077 1.5417733
#>            [,8]      [,9]     [,10]
#>  [1,] 1.4501875 0.8702977 1.2659612
#>  [2,] 2.4852075 2.2809849 2.5169559
#>  [3,] 2.5905433 2.7392631 2.3605332
#>  [4,] 1.6345636 1.7775616 1.6548380
#>  [5,] 0.7842967 0.5863910 1.0833241
#>  [6,] 1.8238442 0.7791879 0.8658993
#>  [7,] 2.1998232 1.2985704 1.8147944
#>  [8,] 1.2364847 1.1256318 2.5079799
#>  [9,] 0.7312208 1.4763993 2.3328189
#> [10,] 1.8367469 2.3297600 2.1275302

pfocal_fast_separated(data, 
                      kernel_list = list(binomial_kernel(vertical_radius = 2, 
                                                         horizontal_radius = 2), 
                                         distance_kernel(vertical_radius = 2,
                                                         horizontal_radius = 2)))
#>           [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
#>  [1,] 1878.256 2379.465 3166.569 3556.385 3594.354 3509.168 3454.406 3196.544
#>  [2,] 2418.869 3022.922 4080.494 4507.243 4452.133 4274.181 4168.491 3810.740
#>  [3,] 3174.129 4036.094 5494.079 6043.143 5933.519 5657.349 5473.911 4976.123
#>  [4,] 3392.004 4352.008 5976.679 6543.600 6378.258 6049.403 5834.313 5288.529
#>  [5,] 3363.047 4357.215 5986.965 6492.195 6265.083 5885.975 5639.256 5111.070
#>  [6,] 3259.353 4255.649 5792.810 6201.251 5935.835 5543.181 5279.072 4781.126
#>  [7,] 3085.774 4068.728 5501.810 5897.770 5717.777 5436.965 5223.300 4734.292
#>  [8,] 2733.561 3663.785 4967.441 5394.444 5346.849 5221.924 5092.427 4628.155
#>  [9,] 1995.223 2710.366 3684.156 3989.311 3945.626 3868.610 3788.075 3449.471
#> [10,] 1449.795 1976.491 2673.497 2853.481 2794.942 2756.694 2733.663 2522.573
#>           [,9]    [,10]
#>  [1,] 2342.700 1736.745
#>  [2,] 2733.707 2012.018
#>  [3,] 3560.834 2557.292
#>  [4,] 3766.923 2649.141
#>  [5,] 3612.782 2529.820
#>  [6,] 3339.946 2368.583
#>  [7,] 3293.479 2377.864
#>  [8,] 3236.869 2389.996
#>  [9,] 2409.264 1850.237
#> [10,] 1812.413 1447.770