Compute the qr factorization of a matrix. Factor the matrix `a` as *qr*, where `q` is orthonormal and `r` is upper-triangular. Parameters ---------- a : array_like, shape (..., M, N) An array-like object with the dimensionality of at least 2. mode : {'reduced',
(a, mode='reduced')
| 788 | |
| 789 | @array_function_dispatch(_qr_dispatcher) |
| 790 | def qr(a, mode='reduced'): |
| 791 | """ |
| 792 | Compute the qr factorization of a matrix. |
| 793 | |
| 794 | Factor the matrix `a` as *qr*, where `q` is orthonormal and `r` is |
| 795 | upper-triangular. |
| 796 | |
| 797 | Parameters |
| 798 | ---------- |
| 799 | a : array_like, shape (..., M, N) |
| 800 | An array-like object with the dimensionality of at least 2. |
| 801 | mode : {'reduced', 'complete', 'r', 'raw'}, optional |
| 802 | If K = min(M, N), then |
| 803 | |
| 804 | * 'reduced' : returns Q, R with dimensions (..., M, K), (..., K, N) (default) |
| 805 | * 'complete' : returns Q, R with dimensions (..., M, M), (..., M, N) |
| 806 | * 'r' : returns R only with dimensions (..., K, N) |
| 807 | * 'raw' : returns h, tau with dimensions (..., N, M), (..., K,) |
| 808 | |
| 809 | The options 'reduced', 'complete, and 'raw' are new in numpy 1.8, |
| 810 | see the notes for more information. The default is 'reduced', and to |
| 811 | maintain backward compatibility with earlier versions of numpy both |
| 812 | it and the old default 'full' can be omitted. Note that array h |
| 813 | returned in 'raw' mode is transposed for calling Fortran. The |
| 814 | 'economic' mode is deprecated. The modes 'full' and 'economic' may |
| 815 | be passed using only the first letter for backwards compatibility, |
| 816 | but all others must be spelled out. See the Notes for more |
| 817 | explanation. |
| 818 | |
| 819 | |
| 820 | Returns |
| 821 | ------- |
| 822 | When mode is 'reduced' or 'complete', the result will be a namedtuple with |
| 823 | the attributes `Q` and `R`. |
| 824 | |
| 825 | Q : ndarray of float or complex, optional |
| 826 | A matrix with orthonormal columns. When mode = 'complete' the |
| 827 | result is an orthogonal/unitary matrix depending on whether or not |
| 828 | a is real/complex. The determinant may be either +/- 1 in that |
| 829 | case. In case the number of dimensions in the input array is |
| 830 | greater than 2 then a stack of the matrices with above properties |
| 831 | is returned. |
| 832 | R : ndarray of float or complex, optional |
| 833 | The upper-triangular matrix or a stack of upper-triangular |
| 834 | matrices if the number of dimensions in the input array is greater |
| 835 | than 2. |
| 836 | (h, tau) : ndarrays of np.double or np.cdouble, optional |
| 837 | The array h contains the Householder reflectors that generate q |
| 838 | along with r. The tau array contains scaling factors for the |
| 839 | reflectors. In the deprecated 'economic' mode only h is returned. |
| 840 | |
| 841 | Raises |
| 842 | ------ |
| 843 | LinAlgError |
| 844 | If factoring fails. |
| 845 | |
| 846 | See Also |
| 847 | -------- |
nothing calls this directly
no test coverage detected