truncated_svd#
- ivy.truncated_svd(x, /, compute_uv=True, n_eigenvecs=None)[source]#
Compute a truncated SVD on x using the standard SVD.
- Parameters:
x (
Union[Array,NativeArray]) – 2D-array compute_uv IfTruethen left and right singular vectors will be computed and returned inUandVh, respectively. Otherwise, only the singular values will be computed, which can be significantly faster.n_eigenvecs (
Optional[int], default:None) – if specified, number of eigen[vectors-values] to return else full matrices will be returned
- Return type:
- Returns:
ret – a namedtuple
(U, S, Vh)Each returned array must have the same floating-point data type asx.
- Array.truncated_svd(self, /, compute_uv=True, n_eigenvecs=None)[source]#
ivy.Array instance method variant of ivy.make_svd_non_negative. This method simply wraps the function, and so the docstring for ivy.make_svd_non_negative also applies to this method with minimal changes.
- Parameters:
x – 2D-array
compute_uv (
bool, default:True) – IfTruethen left and right singular vectors will be computed and returnedv inUandVhrespectively. Otherwise, only the singular values will be computed, which can be significantly faster.n_eigenvecs (
Optional[int], default:None) – if specified, number of eigen[vectors-values] to return else full matrices will be returned
- Return type:
Union[Array,Tuple[Array,Array,Array]]- Returns:
ret – a namedtuple
(U, S, Vh)Each returned array must have the same floating-point data type asx.
- Container.truncated_svd(self, /, compute_uv=True, n_eigenvecs=None, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container instance method variant of ivy.truncated_svd. This method simply wraps the function, and so the docstring for ivy.truncated_svd also applies to this method with minimal changes.
- Parameters:
x – Container of 2D-arrays
compute_uv (
Union[bool,Container], default:True) – IfTruethen left and right singular vectors will be computed and returned inUandVhrespectively. Otherwise, only the singular values will be computed, which can be significantly faster.n_eigenvecs (
Optional[Union[int,Container]], default:None) – if specified, number of eigen[vectors-values] to return else full matrices will be returned
- Return type:
Union[Container,Tuple[Container,Container,Container]]- Returns:
ret – a namedtuple
(U, S, Vh)Each returned container must have the same floating-point data type asx.