Computes lhs %*% t(rhs). If rhs is missing, computes lhs %*% t(lhs).
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_tcrossprod(lhs, rhs = NULL)
# S3 method for class 'AnvlArray'
tcrossprod(x, y = NULL, ...)Arguments
- lhs
(
arrayish)
An array with at least 2 axes, as forbase::tcrossprod(). Can be any numeric data type;lhsandrhsare promoted to a common data type.- rhs
(
arrayish|NULL)
Optional second array. IfNULL, useslhs.- x, y
Same as
lhsandrhs; the names used by the base R S3 generic.- ...
No additional arguments.
Value
(arrayish)
Has the operands' common data type, and the shape of lhs %*% t(rhs).
Examples
# `x %*% t(x)`, so a 2x3 gives a 2x2
x <- nv_matrix(1:6, nrow = 2, dtype = "f32")
nv_tcrossprod(x)
#> AnvlArray
#> 35 44
#> 44 56
#> [ CPUf32{2,2} ]