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 qr().

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

  • overwrite_a (bool, optional) – Whether data in a is overwritten (may improve performance if overwrite_a is set to True by reusing the existing input data structure rather than creating a new one.)

  • lwork (int, optional) – Work array size, lwork >= a.shape[1]. If None or -1, an optimal size is computed.

  • 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.

  • check_finite (bool, optional) – Whether to check that the input matrix contains only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns

  • Q (float or complex ndarray) – Of shape (M, M), or (M, K) for mode='economic'. Not returned if mode='r'.

  • R (float or complex ndarray) – Of shape (M, N), or (K, N) for mode='economic'. K = min(M, N).

  • P (int ndarray) – Of shape (N,) for pivoting=True. Not returned if pivoting=False.