chainerx.linalg.svd

chainerx.linalg.svd(a, full_matrices=True, compute_uv=True)

Singular Value Decomposition.

Factorizes the matrix a into two unitary matrices U and Vt, and a 1-D array s of singular values such that a == U * S * Vt, where S is a suitably shaped matrix of zeros with main diagonal s and * represents a dot product.

Parameters
  • a (ndarray) – The input matrix with dimension (M, N).

  • full_matrices (bool) – If True, it returns u and v with dimensions (M, M) and (N, N). Otherwise, the dimensions of u and v are respectively (M, K) and (K, N), where K = min(M, N).

  • compute_uv (bool) – If False, only singular values are computed.

Returns

A tuple of (U, s, Vt) such that a = U * diag(s) * Vt. When compute_uv is False only singular values s are returned.

Return type

tuple of chainerx.ndarray

Note

  • The dtype must be float32 or float64 (float16 is not supported yet.)

  • The SVD is commonly written as a = U * diag(s) * V^T. The Vt returned by this function is V^T.

  • During backpropagation, this function requires U and Vt computed, therefore differentiation does not work for compute_uv=False.

  • Backpropagation is not implemented for full_matrices=True.