Computes t(x) %*% y. If y is missing, computes t(x) %*% x.
Above rank 2 the last two axes are the matrix and the leading ones are batch
axes, as in nv_matmul(): only the matrix is transposed.
Usage
nv_crossprod(x, y = NULL)
# S3 method for class 'AnvlArray'
crossprod(x, y = NULL, ...)Arguments
- x
(
arrayish)
An array with at least 2 axes, as forbase::crossprod(). Can be any numeric data type;xandyare promoted to a common data type.- y
(
arrayish|NULL)
Optional second array. IfNULL, usesx.- ...
No additional arguments.
Value
(arrayish)
Has the operands' common data type, and the shape of t(x) %*% y.
Examples
# `t(x) %*% x`, so a 3x2 gives a 2x2
x <- nv_matrix(1:6, nrow = 3, dtype = "f32")
nv_crossprod(x)
#> AnvlArray
#> 14 32
#> 32 77
#> [ CPUf32{2,2} ]