pypose.optim.solver.Cholesky¶
- class pypose.optim.solver.Cholesky(upper=False)[source]¶
The batched linear solver with Cholesky decomposition.
\[\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. Note that \(\mathbf{A}_i\) has to be a complex Hermitian or a real symmetric positive-definite matrix.
The solution is given by
\[\begin{align*} \bm{L}_i &= \mathrm{cholesky}(\mathbf{A}_i), \\ \bm{x}_i &= \mathrm{cholesky\_solve}(\mathbf{b}_i, \bm{L}_i), \\ \end{align*} \]where \(\mathrm{cholesky}()\) is the Cholesky decomposition function.
More details go to torch.linalg.cholesky and torch.cholesky_solve.
- Parameters
upper (bool, optional) – whether use an upper triangular matrix in Cholesky decomposition. Default:
False
.
Examples
>>> import pypose.optim.solver as ppos >>> A = torch.tensor([[[1.00, 0.10, 0.00], [0.10, 1.00, 0.20], [0.00, 0.20, 1.00]], [[1.00, 0.20, 0.10], [0.20, 1.00, 0.20], [0.10, 0.20, 1.00]]]) >>> b = torch.tensor([[[1.], [2.], [3.]], [[1.], [2.], [3.]]]) >>> solver = ppos.Cholesky() >>> x = solver(A, b) tensor([[[0.8632], [1.3684], [2.7263]], [[0.4575], [1.3725], [2.6797]]])