
Last chance! 50% off unlimited learning
Sale ends in
Qr
torch_qr(self, some = TRUE)
(Tensor) the input tensor of size *
is zero or more batch dimensions consisting of matrices of dimension
(bool, optional) Set to TRUE
for reduced QR decomposition and FALSE
for complete QR decomposition.
Computes the QR decomposition of a matrix or a batch of matrices input
,
and returns a namedtuple (Q, R) of tensors such that
If some
is TRUE
, then this function returns the thin (reduced) QR factorization.
Otherwise, if some
is FALSE
, this function returns the complete QR factorization.
if (torch_is_installed()) {
a = torch_tensor(matrix(c(12., -51, 4, 6, 167, -68, -4, 24, -41), ncol = 3, byrow = TRUE))
out = torch_qr(a)
q = out[[1]]
r = out[[2]]
torch_mm(q, r)$round()
torch_mm(q$t(), q)$round()
}
Run the code above in your browser using DataLab