# jax.scipy.linalg.qr#

jax.scipy.linalg.qr(a, overwrite_a=False, lwork=None, mode='full', pivoting=False, check_finite=True)[source]#

Compute QR decomposition of a matrix.

LAX-backend implementation of `scipy.linalg._decomp_qr.qr()`.

Does not support the Scipy argument `check_finite=True`, because compiled JAX code cannot perform checks of array values at runtime.

Does not support the Scipy argument `overwrite_*=True`.

Original docstring below.

Calculate the decomposition `A = Q R` where Q is unitary/orthogonal and R upper triangular.

Parameters:
• a ((M, N) array_like) â€“ Matrix to be decomposed

• mode ({'full', 'r', 'economic', 'raw'}, optional) â€“ Determines what information is to be returned: either both Q and R (â€˜fullâ€™, default), only R (â€˜râ€™) or both Q and R but computed in economy-size (â€˜economicâ€™, see Notes). The final option â€˜rawâ€™ (added in SciPy 0.11) makes the function return two matrices (Q, TAU) in the internal format used by LAPACK.

• pivoting (bool, optional) â€“ Whether or not factorization should include pivoting for rank-revealing qr decomposition. If pivoting, compute the decomposition `A P = Q R` as above, but where P is chosen such that the diagonal of R is non-increasing.

• overwrite_a (bool) â€“

• lwork (Any) â€“

• check_finite (bool) â€“

Return type:

tuple[Array] | tuple[Array, Array]

Returns:

• Q (float or complex ndarray) â€“ Of shape (M, M), or (M, K) for `mode='economic'`. Not returned if `mode='r'`. Replaced by tuple `(Q, TAU)` if `mode='raw'`.

• R (float or complex ndarray) â€“ Of shape (M, N), or (K, N) for `mode in ['economic', 'raw']`. `K = min(M, N)`.

• P (int ndarray) â€“ Of shape (N,) for `pivoting=True`. Not returned if `pivoting=False`.