rq(a, overwrite_a=False, lwork=None, mode='full', check_finite=True)
Calculate the decomposition A = R Q
where Q is unitary/orthogonal and R upper triangular.
This is an interface to the LAPACK routines sgerqf, dgerqf, cgerqf, zgerqf, sorgrq, dorgrq, cungrq and zungrq.
If mode=economic
, the shapes of Q and R are (K, N) and (M, K) instead of (N,N) and (M,N), with K=min(M,N)
.
Matrix to be decomposed
Whether data in a is overwritten (may improve performance)
Work array size, lwork >= a.shape[1]. If None or -1, an optimal size is computed.
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).
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.
If decomposition fails.
Of shape (M, N) or (M, K) for mode='economic'
. K = min(M, N)
.
Of shape (N, N) or (K, N) for mode='economic'
. Not returned if mode='r'
.
Compute RQ decomposition of a matrix.
>>> from scipy import linalg
... rng = np.random.default_rng()
... a = rng.standard_normal((6, 9))
... r, q = linalg.rq(a)
... np.allclose(a, r @ q) True
>>> r.shape, q.shape ((6, 9), (9, 9))
>>> r2 = linalg.rq(a, mode='r')
... np.allclose(r, r2) True
>>> r3, q3 = linalg.rq(a, mode='economic')See :
... r3.shape, q3.shape ((6, 6), (6, 9))
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.linalg._decomp_qr.rq
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them