`Linear()` computes the inner product between all possible pairs of rows of a matrix or data.frame with dimension NxD.
Arguments
- X
Matrix or data.frame that contains real numbers ("integer", "float" or "double").
- cos.norm
Should the resulting kernel matrix be cosine normalized? (Defaults: FALSE).
- coeff
(optional) A vector of length D that weights each one of the features (columns). When cos.norm=TRUE, `Linear()` first does the weighting and then the cosine-normalization.
Examples
dat <- matrix(rnorm(250),ncol=50,nrow=5)
Linear(dat)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 59.511095 -1.2741200 -10.900658 -12.2677519 7.678785
#> [2,] -1.274120 57.6852052 -2.967514 0.3842339 5.214374
#> [3,] -10.900658 -2.9675144 50.612273 10.4069230 -1.919365
#> [4,] -12.267752 0.3842339 10.406923 62.4838994 3.549917
#> [5,] 7.678785 5.2143740 -1.919365 3.5499166 46.013724