factorize

Function factorize 

Source
pub fn factorize(
    t: &TensorDynLen,
    left_inds: &[DynIndex],
    options: &FactorizeOptions,
) -> Result<FactorizeResult<TensorDynLen>, FactorizeError>
Expand description

Factorize a tensor into left and right factors.

This function dispatches to the appropriate algorithm based on options.alg:

  • SVD: Singular Value Decomposition
  • QR: QR decomposition
  • LU: Rank-revealing LU decomposition
  • CI: Cross Interpolation

The canonical option controls which factor is “canonical”:

  • Canonical::Left: Left factor is orthogonal (SVD/QR) or unit-diagonal (LU/CI)
  • Canonical::Right: Right factor is orthogonal (SVD) or unit-diagonal (LU/CI)

§Arguments

  • t - Input tensor
  • left_inds - Indices to place on the left side
  • options - Factorization options

§Returns

A FactorizeResult containing the left and right factors, bond index, singular values (for SVD), and rank.

§Errors

Returns FactorizeError if:

  • The storage type is not supported (only DenseF64 and DenseC64)
  • QR is used with Canonical::Right
  • The underlying algorithm fails