t3toolbox.backend.linalg.outer_svd_3tensor#

t3toolbox.backend.linalg.outer_svd_3tensor(G0_i_a_j: NDArray, min_rank: int = None, max_rank: int = None, rtol: float = None, atol: float = None, use_jax: bool = False) t3toolbox.backend.common.typ.Tuple[NDArray, NDArray, NDArray]#

Compute (truncated) singular value decomposition of 3-tensor outer unfolding.

First and last indices of the tensor are grouped to form rows for the SVD. Middle index forms columns.

G0_i_a_j = einsum(‘iax,x,xj->ixj’, U_i_x_j, ss_x, Vt_x_a). Equality may be approximate if truncation is used.

Parameters:
  • G0_i_a_j (NDArray) – 3-tensor. shape=(ni, na, nj)

  • min_rank (int) – Minimum rank for truncation.

  • min_rank – Maximum rank for truncation.

  • rtol (float) – Relative tolerance for truncation.

  • atol (float) – Absolute tolerance for truncation.

  • xnp – Linear algebra backend. Default: np (numpy)

Returns:

  • U_i_x_j (NDArray) – Left singular vectors. shape=(ni, nx, nj). einsum(‘ixj,iyj->xy’, U_i_x_j, U_i_x_j) = identity matrix

  • ss_x (NDArray) – Singular values. Non-negative. shape=(nx,).

  • Vt_x_a (NDArray) – Right singular vectors. shape=(nx, na) einsum(‘xa,ya->xy’, Vt_x_a, Vt_x_a) = identity matrix

Raises:

RuntimeError – Error raised if the provided indices in index are inconsistent with each other or the Tucker tensor train x.

See also

truncated_svd, left_svd_3tensor, right_svd_3tensor, up_svd_ith_tt_core, down_svd_ith_tt_core, t3_svd

Examples

>>> import numpy as np
>>> import t3toolbox.orthogonalization as orth
>>> G_i_a_j = np.random.randn(5,7,6)
>>> U_i_x_j, ss_x, Vt_x_a = orth.outer_svd_3tensor(G_i_a_j)
>>> G_i_a_j2 = np.einsum('ixj,x,xa->iaj', U_i_x_j, ss_x, Vt_x_a)
>>> print(np.linalg.norm(G_i_a_j - G_i_a_j2)) # SVD exact to numerical precision
1.4102138928233928e-14
>>> rank = len(ss_x)
>>> print(np.linalg.norm(np.einsum('ixj,iyj->xy', U_i_x_j, U_i_x_j) - np.eye(rank))) # U is outer-orthogonal
3.3426764835898436e-15
>>> print(np.linalg.norm(np.einsum('xa,ya->xy', Vt_x_a, Vt_x_a) - np.eye(rank))) # Vt is orthogonal
1.8969691003092744e-15