fn

ger

Tensor
ger(vec1: Tensor, vec2: Tensor)
source

Outer product of two 1-D tensors.

Forwards to lucid.linalg.outer. Provided under the legacy BLAS name (ger = "general rank-one update") for API parity.

Parameters

vec1Tensor
1-D tensor of length M.
vec2Tensor
1-D tensor of length N.

Returns

Tensor

2-D tensor of shape (M, N) holding the outer product.

Notes

Mathematical definition:

outij=vec1ivec2j.\text{out}_{ij} = \text{vec1}_i \cdot \text{vec2}_j.

The result is always rank-1 (in the linear-algebra sense). Use addr to perform a rank-1 update in place of an accumulator.

Examples

>>> import lucid
>>> u = lucid.tensor([1., 2., 3.])
>>> v = lucid.tensor([4., 5.])
>>> lucid.ger(u, v)
Tensor([[ 4.,  5.],
        [ 8., 10.],
        [12., 15.]])