///|
/// An economy QR factorisation, `a = q * r`, with `q` of orthonormal columns
/// and `r` upper triangular.
///
/// `q` has the same shape as `a` and `r` is square, which is the form the
/// least-squares step and the UKF's square root need.
#derive(Debug)
pub(all) struct Qr {
  q : Mat
  r : Mat
}

///|
/// Factorise `a` as `q * r` with Householder reflections.
///
/// Raises `Refused::Dimension` when `a` has fewer rows than columns: an economy
/// factorisation cannot represent that shape.
pub fn qr(a : Mat) -> Qr raise Refused {
  let m = a.rows
  let n = a.cols
  if n == 0 || m == 0 {
    raise Refused::Empty
  }
  if m < n {
    raise Refused::Dimension(got=m, want=n)
  }
  let work = Mat::zeros(m, n)
  for i in 0..= 0.0 { -norm } else { norm }
    let v = Vec::zeros(length)
    for i in 0..=..0 {
    let v = reflectors[k]
    let length = v.len()
    if length == 0 {
      continue
    }
    for j in 0..