PyTorch torch.org function
PyTorch torch reference manual
torch.org is a function in PyTorch used to extract an orthogonal matrix from the result of a QR decomposition. This function is usually used together with torch.geqrf to obtain the orthogonal matrix Q from the result of the QR decomposition.
Function definition
torch.org(A)
Usage examples
Example
import
torch
Create a matrix
A
=
torch.
randn
(
3
,
3
)
First perform QR decomposition (geqrf)
Q
,
R
=
torch.
geqrf
(
A
)
Use org to extract the orthogonal matrix from the QR result
Q_ortho
=
torch.
org
(
A
)
(
"Q matrix:"
)
(
Q_ortho
)
The output is:
tensor([[-0.1234, 0.5678, -0.8123],
[ 0.4567, -0.2345, 0.5678],
[ 0.7890, 0.6789, 0.1234]])