(self, a, b, tags)
| 743 | class SVDHermitianCases(HermitianTestCase, HermitianGeneralizedTestCase): |
| 744 | |
| 745 | def do(self, a, b, tags): |
| 746 | u, s, vt = linalg.svd(a, False, hermitian=True) |
| 747 | assert_allclose(a, matmul(np.asarray(u) * np.asarray(s)[..., None, :], |
| 748 | np.asarray(vt)), |
| 749 | rtol=get_rtol(u.dtype)) |
| 750 | |
| 751 | def hermitian(mat): |
| 752 | axes = list(range(mat.ndim)) |
| 753 | axes[-1], axes[-2] = axes[-2], axes[-1] |
| 754 | return np.conj(np.transpose(mat, axes=axes)) |
| 755 | |
| 756 | expected = np.broadcast_to(np.eye(u.shape[-1]), u.shape) |
| 757 | assert_almost_equal(np.matmul(u, hermitian(u)), expected) |
| 758 | expected = np.broadcast_to(np.eye(vt.shape[-1]), vt.shape) |
| 759 | assert_almost_equal(np.matmul(vt, hermitian(vt)), expected) |
| 760 | assert_equal(np.sort(s)[..., ::-1], s) |
| 761 | assert_(consistent_subclass(u, a)) |
| 762 | assert_(consistent_subclass(vt, a)) |
| 763 | |
| 764 | |
| 765 | class TestSVDHermitian(SVDHermitianCases, SVDBaseTests): |
nothing calls this directly
no test coverage detected