A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/main/generated/torch.cholesky_solve.html below:

torch.cholesky_solve — PyTorch main documentation

Computes the solution of a system of linear equations with complex Hermitian or real symmetric positive-definite lhs given its Cholesky decomposition.

Let A A A be a complex Hermitian or real symmetric positive-definite matrix, and L L L its Cholesky decomposition such that:

A = L LH A = LL^{\text{H}} A=LLH

where LH L^{\text{H}} LH is the conjugate transpose when L L L is complex, and the transpose when L L L is real-valued.

Returns the solution X X X of the following linear system:

A X = B AX = B AX=B

Supports inputs of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if A A A or B B B is a batch of matrices then the output has the same batch dimensions.

Parameters
Keyword Arguments

out (Tensor, optional) – output tensor. Ignored if None. Default: None.

Example:

>>> A = torch.randn(3, 3)
>>> A = A @ A.T + torch.eye(3) * 1e-3 # Creates a symmetric positive-definite matrix
>>> L = torch.linalg.cholesky(A) # Extract Cholesky decomposition
>>> B = torch.randn(3, 2)
>>> torch.cholesky_solve(B, L)
tensor([[ -8.1625,  19.6097],
        [ -5.8398,  14.2387],
        [ -4.3771,  10.4173]])
>>> A.inverse() @  B
tensor([[ -8.1626,  19.6097],
        [ -5.8398,  14.2387],
        [ -4.3771,  10.4173]])

>>> A = torch.randn(3, 2, 2, dtype=torch.complex64)
>>> A = A @ A.mH + torch.eye(2) * 1e-3 # Batch of Hermitian positive-definite matrices
>>> L = torch.linalg.cholesky(A)
>>> B = torch.randn(2, 1, dtype=torch.complex64)
>>> X = torch.cholesky_solve(B, L)
>>> torch.dist(X, A.inverse() @ B)
tensor(1.6881e-5)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4