Computes x %*% t(y) (or x %*% t(x) if y is
NULL) using the accelerator if either argument is a torch tensor and
an accelerator is active; falls back to tcrossprod
otherwise. Exposed so downstream packages (e.g. spiDE) can build their own
GPU-blocked linear algebra with the same dual (tensor-or-matrix) semantics
SpaNorm's own fitting uses.
Usage
tcrossprod_gpu(x, y = NULL)
Arguments
- x
a matrix or torch tensor.
- y
a matrix or torch tensor, or NULL (default).
Value
x %*% t(y), as a matrix or torch tensor matching the input.
Examples
m <- matrix(rnorm(12), nrow = 3)
tcrossprod_gpu(m)
#> [,1] [,2] [,3]
#> [1,] 5.5146216 0.6169506 0.8411992
#> [2,] 0.6169506 5.5776896 -0.6193977
#> [3,] 0.8411992 -0.6193977 6.6981942