`Laplace()` computes the laplacian kernel between all possible pairs of rows of a matrix or data.frame with dimension NxD.
Details
Let \(x_i,x_j\) be two real vectors. Then, the laplacian kernel is defined as: $$K_{Lapl}(x_i,x_j)=\exp(-\gamma \|x_i - x_j \|_1)$$
Examples
dat <- matrix(rnorm(250),ncol=50,nrow=5)
Laplace(dat,g=0.1)
#> 1 2 3 4 5
#> 1 1.000000000 0.004568629 0.0021219998 0.0040553342 0.005260681
#> 2 0.004568629 1.000000000 0.0060090614 0.0035829360 0.007325958
#> 3 0.002122000 0.006009061 1.0000000000 0.0009814867 0.003059022
#> 4 0.004055334 0.003582936 0.0009814867 1.0000000000 0.010675679
#> 5 0.005260681 0.007325958 0.0030590219 0.0106756795 1.000000000