qr#
- class saiunit.lax.qr(x)#
QR decomposition.
Compute the QR decomposition \(A = Q \cdot R\) where \(Q\) is a unitary (orthogonal) matrix and \(R\) is upper-triangular.
- Parameters:
x (
Union[saiunit.Quantity,Array,ndarray,number,bool]) – A batch of matrices with shape[..., m, n].- Return type:
- Returns:
q (Array) – The unitary factor (unitless) with shape
[..., m, min(m, n)].r (Array or Quantity) – The upper-triangular factor with shape
[..., min(m, n), n]. Ifxhas a unit,rpreserves that unit.
Examples
>>> import jax.numpy as jnp >>> import saiunit as u >>> import saiunit.lax as sulax >>> A = jnp.array([[1.0, 2.0], [3.0, 4.0]]) * u.meter >>> q, r = sulax.qr(A) >>> u.get_unit(r) == u.meter True