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.

  • 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).

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