pub fn householder_product<T: KernelLinalgScalar + Conjugate, C>(
ctx: &mut C,
a: &Tensor<T>,
tau: &Tensor<T>,
) -> Result<Tensor<T>>where
C: TensorLinalgContextFor<T> + TensorResolveConjContextFor<T> + TensorScalarContextFor<Standard<T>> + TensorSemiringContextFor<Standard<T>>,
C::Backend: 'static,Expand description
Form the explicit product of Householder reflectors.
Given a lower-triangular Householder factor matrix a of shape (m, n, *)
and a vector tau of shape (k, *), computes the orthogonal matrix Q.
ยงExamples
use tenferro_linalg::householder_product;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let col = MemoryOrder::ColumnMajor;
// Typically obtained from an intermediate QR step.
let a = Tensor::<f64>::from_slice(
&[1.0, 0.5, 0.0, 1.0], &[2, 2], col,
).unwrap();
let tau = Tensor::<f64>::from_slice(&[1.0, 0.5], &[2], col).unwrap();
let q = householder_product(&mut ctx, &a, &tau).unwrap();
assert_eq!(q.dims(), &[2, 2]);