scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
qr_multiply(a, c, mode='right', pivoting=False, conjugate=False, overwrite_a=False, overwrite_c=False)

Calculate the decomposition A = Q R where Q is unitary/orthogonal and R upper triangular. Multiply Q with a vector or a matrix c.

Notes

This is an interface to the LAPACK routines ?GEQRF , ?ORMQR , ?UNMQR , and ?GEQP3 .

versionadded

Parameters

a : (M, N), array_like

Input array

c : array_like

Input array to be multiplied by q .

mode : {'left', 'right'}, optional

Q @ c is returned if mode is 'left', c @ Q is returned if mode is 'right'. The shape of c must be appropriate for the matrix multiplications, if mode is 'left', min(a.shape) == c.shape[0] , if mode is 'right', a.shape[0] == c.shape[1] .

pivoting : bool, optional

Whether or not factorization should include pivoting for rank-revealing qr decomposition, see the documentation of qr.

conjugate : bool, optional

Whether Q should be complex-conjugated. This might be faster than explicit conjugation.

overwrite_a : bool, optional

Whether data in a is overwritten (may improve performance)

overwrite_c : bool, optional

Whether data in c is overwritten (may improve performance). If this is used, c must be big enough to keep the result, i.e. c.shape[0] = a.shape[0] if mode is 'left'.

Raises

LinAlgError

Raised if QR decomposition fails.

Returns

CQ : ndarray

The product of Q and c .

R : (K, N), ndarray

R array of the resulting QR factorization where K = min(M, N) .

P : (N,) ndarray

Integer pivot array. Only returned when pivoting=True .

Calculate the QR decomposition and multiply Q with a matrix.

Examples

>>> from scipy.linalg import qr_multiply, qr
... A = np.array([[1, 3, 3], [2, 3, 2], [2, 3, 3], [1, 3, 2]])
... qc, r1, piv1 = qr_multiply(A, 2*np.eye(4), pivoting=1)
... qc array([[-1., 1., -1.], [-1., -1., 1.], [-1., -1., -1.], [-1., 1., 1.]])
>>> r1
array([[-6., -3., -5.            ],
       [ 0., -1., -1.11022302e-16],
       [ 0.,  0., -1.            ]])
>>> piv1
array([1, 0, 2], dtype=int32)
>>> q2, r2, piv2 = qr(A, mode='economic', pivoting=1)
... np.allclose(2*q2 - qc, np.zeros((4, 3))) True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.linalg._decomp_update.qr_insert scipy.linalg._decomp_update.qr_delete scipy.linalg._decomp_qr.qr_multiply scipy.linalg._decomp_update.qr_update

Local connectivity graph

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


GitHub : /scipy/linalg/_decomp_qr.py#177
type: <class 'function'>
Commit: