mlx.core.linalg.qr#
- qr(a: array, *, stream: None | Stream | Device = None) Tuple[array, array] #
The QR factorization of the input matrix.
This function supports arrays with at least 2 dimensions. The matrices which are factorized are assumed to be in the last two dimensions of the input.
- Parameters:
- Returns:
The
Q
andR
matrices.- Return type:
Example
>>> A = mx.array([[2., 3.], [1., 2.]]) >>> Q, R = mx.linalg.qr(A, stream=mx.cpu) >>> Q array([[-0.894427, -0.447214], [-0.447214, 0.894427]], dtype=float32) >>> R array([[-2.23607, -3.57771], [0, 0.447214]], dtype=float32)