SciPy

scipy.linalg.qr_multiply

scipy.linalg.qr_multiply(a, c, mode='right', pivoting=False, conjugate=False, overwrite_a=False, overwrite_c=False)[source]

Calculate the QR decomposition and multiply Q with a matrix.

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

Parameters:

a : ndarray, shape (M, N)

Matrix to be decomposed

c : ndarray, one- or two-dimensional

calculate the product of c and q, depending on the mode:

mode : {‘left’, ‘right’}, optional

dot(Q, c) is returned if mode is ‘left’, dot(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’.

Returns:

CQ : float or complex ndarray

the product of Q and c, as defined in mode

R : float or complex ndarray

Of shape (K, N), K = min(M, N).

P : ndarray of ints

Of shape (N,) for pivoting=True. Not returned if pivoting=False.

Raises:

LinAlgError

Raised if decomposition fails

Notes

This is an interface to the LAPACK routines dgeqrf, zgeqrf, dormqr, zunmqr, dgeqp3, and zgeqp3.

New in version 0.11.0.

Previous topic

scipy.linalg.qr

Next topic

scipy.linalg.rq