jax.numpy.linalg.qr¶

jax.numpy.linalg.qr(a, mode='reduced')[source]¶

Compute the qr factorization of a matrix.

LAX-backend implementation of qr().

Original docstring below.

Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.

Parameters
  • a (array_like, shape (M, N)) – Matrix to be factored.

  • mode ({'reduced', 'complete', 'r', 'raw'}, optional) –

    If K = min(M, N), then

    • ’reduced’ : returns q, r with dimensions (M, K), (K, N) (default)

    • ’complete’ : returns q, r with dimensions (M, M), (M, N)

    • ’r’ : returns r only with dimensions (K, N)

    • ’raw’ : returns h, tau with dimensions (N, M), (K,)

    The options ‘reduced’, ‘complete, and ‘raw’ are new in numpy 1.8, see the notes for more information. The default is ‘reduced’, and to maintain backward compatibility with earlier versions of numpy both it and the old default ‘full’ can be omitted. Note that array h returned in ‘raw’ mode is transposed for calling Fortran. The ‘economic’ mode is deprecated. The modes ‘full’ and ‘economic’ may be passed using only the first letter for backwards compatibility, but all others must be spelled out. See the Notes for more explanation.

Returns

  • q (ndarray of float or complex, optional) – A matrix with orthonormal columns. When mode = ‘complete’ the result is an orthogonal/unitary matrix depending on whether or not a is real/complex. The determinant may be either +/- 1 in that case.

  • r (ndarray of float or complex, optional) – The upper-triangular matrix.

  • (h, tau) (ndarrays of np.double or np.cdouble, optional) – The array h contains the Householder reflectors that generate q along with r. The tau array contains scaling factors for the reflectors. In the deprecated ‘economic’ mode only h is returned.