fn

outer

Tensor
outer(x: Tensor, y: Tensor)
source

Outer product of two 1-D tensors.

Parameters

xTensor
1-D tensor of length mm.
yTensor
1-D tensor of length nn.

Returns

Tensor

Matrix of shape (m, n).

Notes

Computes the rank-1 matrix

(xy)ij=xiyj,(x \otimes y)_{ij} \,=\, x_i\, y_j,

yielding the same result as xyx\,y^\top viewed as a 2-D array. Outer products underpin rank-1 updates (BFGS), Kronecker-product factorisations, and certain attention patterns. Unlike matmul, the inputs are not contracted — every pair (xi,yj)(x_i, y_j) produces an independent entry.

Examples

>>> import lucid
>>> from lucid.linalg import outer
>>> outer(lucid.tensor([1.0, 2.0]), lucid.tensor([3.0, 4.0]))
Tensor([[3.0000, 4.0000],
        [6.0000, 8.0000]])