fn
pinv
→Tensorpinv(x: Tensor)Moore-Penrose pseudo-inverse of a matrix.
Returns the unique matrix satisfying the four Moore-Penrose conditions
For a thin SVD , the pseudo-inverse is
Parameters
xTensorInput matrix of shape
(*, m, n). Need not be square or
full-rank.Returns
TensorPseudo-inverse of shape (*, n, m).
Notes
For square, full-rank matrices pinv is equivalent to inv
— Lucid routes that case through inv to keep autograd active.
For rectangular or rank-deficient inputs the SVD-based engine
kernel is invoked (no backward).
The pseudo-inverse provides the least-squares solution of even when is singular: .
Examples
>>> import lucid
>>> from lucid.linalg import pinv
>>> A = lucid.tensor([[1.0, 0.0], [0.0, 2.0], [0.0, 0.0]])
>>> pinv(A) @ A
Tensor([[1.0000, 0.0000],
[0.0000, 1.0000]])