cupy.linalg.qr#

cupy.linalg.qr(a, mode='reduced')[source]#

QR decomposition.

Decompose a given two-dimensional matrix into Q * R, where Q is an orthonormal and R is an upper-triangular matrix.

Parameters:
  • a (cupy.ndarray) – The input matrix.

  • mode (str) – The mode of decomposition. Currently ‘reduced’, ‘complete’, ‘r’, and ‘raw’ modes are supported. The default mode is ‘reduced’, in which matrix A = (..., M, N) is decomposed into Q, R with dimensions (..., M, K), (..., K, N), where K = min(M, N).

Returns:

Although the type of returned object depends on the mode, it returns a tuple of (Q, R) by default. For details, please see the document of numpy.linalg.qr().

Return type:

cupy.ndarray, or tuple of ndarray

Warning

This function calls one or more cuSOLVER routine(s) which may yield invalid results if input conditions are not met. To detect these invalid results, you can set the linalg configuration to a value that is not ignore in cupyx.errstate() or cupyx.seterr().