Skip to content
fn

outer

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

Implementing kernel

C++ engine symbols that back this Python API.

Outer product of two 1-D tensors.

Parameters

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

Returns

Tensor

Matrix of shape (m, n).

Notes

Computes the rank-1 matrix

(x⊗y)ij = xi yj,(x \otimes y)_{ij} \,=\, x_i\, y_j,

yielding the same result as x y⊤x\,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., 4.], [6., 8.]])