# chainerx.linalg.qr¶

chainerx.linalg.qr(a, mode='reduced')

Compute the qr factorization of a matrix.

Factor the matrix a as qr, where q is orthonormal and r is upper-triangular.

Parameters
• a (ndarray) – Matrix to be factored.

• mode (str) – The mode of decomposition. ‘reduced’ : returns q, r with dimensions (M, K), (K, N) (default) ‘complete’ : returns q, r with dimensions (M, M), (M, N) ‘r’ : returns r only with dimensions (K, N) ‘raw’ : returns h, tau with dimensions (N, M), (K,), where (M, N) is the shape of the input matrix and K = min(M, N)

Returns

A matrix with orthonormal columns. r (~chainerx.ndarray): The upper-triangular matrix.

Return type

q (ndarray)

Note

• The dtype must be float32 or float64 (float16 is not supported yet.)

• Backpropagation is not implemented for non-square output matrix r.

• Backpropagation is not implemented for ‘r’ or ‘raw’ modes.