Shortcuts

pypose.optim.solver.PINV

class pypose.optim.solver.PINV(atol=None, rtol=None, hermitian=False)[source]

The batched linear solver with pseudo inversion.

\[\mathbf{A}_i \bm{x}_i = \mathbf{b}_i, \]

where \(\mathbf{A}_i \in \mathbb{C}^{M \times N}\) and \(\bm{b}_i \in \mathbb{C}^{M \times 1}\) are the \(i\)-th item of batched linear equations.

The solution is given by

\[\bm{x}_i = \mathrm{pinv}(\mathbf{A}_i) \mathbf{b}_i, \]

where \(\mathrm{pinv}()\) is the pseudo inversion function.

Parameters:
  • atol (float, Tensor, optional) – the absolute tolerance value. When None it’s considered to be zero. Default: None.

  • rtol (float, Tensor, optional) – the relative tolerance value. Default: None.

  • hermitian (bool, optional) – indicates whether \(\mathbf{A}\) is Hermitian if complex or symmetric if real. Default: False.

More details go to torch.linalg.pinv.

Warning

It is always preferred to use LSTSQ(), which is faster and more numerically stable.

Examples

>>> import pypose.optim.solver as ppos
>>> A, b = torch.randn(2, 3, 3), torch.randn(2, 3, 1)
>>> solver = ppos.PINV()
>>> x = solver(A, b)
tensor([[[-0.2675],
         [-0.1897],
         [ 0.2708]],
        [[-0.3472],
         [ 1.1191],
         [ 0.3301]]])
forward(A, b)[source]
Parameters:
  • A (Tensor) – the input batched tensor.

  • b (Tensor) – the batched tensor on the right hand side.

Returns:

the solved batched tensor.

Return type:

Tensor

Docs

Access documentation for PyPose

View Docs

Tutorials

Get started with tutorials and examples

View Tutorials

Get Started

Find resources and how to start using pypose

View Resources