Coverage for src / cvx / linalg / svd.py: 100%
5 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-19 05:40 +0000
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-19 05:40 +0000
1"""Raw singular value decomposition utilities."""
3from __future__ import annotations
5import numpy as np
7from .types import Matrix
10def svd(matrix: Matrix) -> tuple[Matrix, Matrix, Matrix]:
11 """Compute the compact singular value decomposition of a matrix.
13 This is a thin wrapper around ``numpy.linalg.svd`` with
14 ``full_matrices=False``.
16 Args:
17 matrix: Input matrix of shape ``(m, n)``.
19 Returns:
20 Tuple ``(u, s, vt)`` such that ``matrix == u @ np.diag(s) @ vt``.
21 """
22 return np.linalg.svd(matrix, full_matrices=False)