SVDecomposition

class trainsum.svdecomposition.SVDecomposition(*, max_rank=50, cutoff=0.0)

Singular value decomposition. The number of singular values to keep is determined by max_rank and cutoff. All singular values below cutoff are discarded, and at most max_rank singular values are kept.

Parameters:
  • max_rank (int)

  • cutoff (float)

right(mat)

Calculate \(U \Sigma V^H\) and return \(U \Sigma\) and \(V^H\).

Parameters:

mat (T)

Return type:

SVDecompositionResult

left(mat)

Calculate \(U \Sigma V^H\) and return \(U\) and \(\Sigma V^H\).

Parameters:

mat (T)

Return type:

SVDecompositionResult

left_shape(shape)

Calculate the shape of the left function.

Parameters:

shape (tuple[int, int])

Return type:

tuple[tuple[int, int], tuple[int, int]]

right_shape(shape)

Calculate the shape of the right function.

Parameters:

shape (tuple[int, int])

Return type:

tuple[tuple[int, int], tuple[int, int]]