Skip to main content

cp_als

Function cp_als 

Source
pub fn cp_als(
    tensor: &DenseTensor,
    rank: usize,
    max_iter: usize,
    tol: f64,
) -> CpDecomposition
Expand description

Alternating Least Squares (ALS) for CP decomposition of a 3-way tensor.

Decomposes tensor (shape n0 × n1 × n2) into rank components. Returns the factor matrices A (n0×rank), B (n1×rank), C (n2×rank) and normalisation weights λ.

§Arguments

  • tensor – reference to a DenseTensor with rank 3
  • rank – number of CP components
  • max_iter – maximum ALS iterations
  • tol – relative reconstruction error tolerance for convergence