addr(input: Tensor, vec1: Tensor, vec2: Tensor, beta: _float = ..., alpha: _float = ...)Rank-1 update of a matrix by an outer product (BLAS-2 ger).
Computes
,
i.e. updates the matrix input by adding the (scaled) outer product
of two vectors. The classical BLAS ger routine.
Parameters
Returns
TensorUpdated matrix of shape (M, N).
Notes
Element-wise:
The outer product is a rank-1 matrix, so this update can be used to build rank-1 corrections in optimisation algorithms (Broyden / BFGS).
Examples
>>> import lucid
>>> M = lucid.zeros((2, 3))
>>> u = lucid.tensor([1., 2.])
>>> v = lucid.tensor([3., 4., 5.])
>>> lucid.addr(M, u, v)
Tensor([[ 3., 4., 5.],
[ 6., 8., 10.]])