mlx.core.linalg.svd

目錄

mlx.core.linalg.svd#

svd(a: array, compute_uv: bool = True, *, stream: None | Stream | Device = None) Tuple[array, array, array]#

輸入矩陣的奇異值分解(SVD)。

This function supports arrays with at least 2 dimensions. When the input has more than two dimensions, the function iterates over all indices of the first a.ndim - 2 dimensions and for each combination SVD is applied to the last two indices.

參數:
  • a (array) -- Input array.

  • compute_uv (bool, optional) -- If True, return the U, S, and Vt components. If False, return only the S array. Default: True.

  • stream (Stream, optional) -- Stream or device. Defaults to None in which case the default stream of the default device is used.

回傳:

If compute_uv is True returns the U, S, and Vt matrices, such that A = U @ diag(S) @ Vt. If compute_uv is False returns singular values array S.

回傳型別:

Union[tuple(array, ...), array]