Skip to content

Commit 7848bd8

Browse files
committed
decompositions: Rewrite comments in constructors in JacobiSVD
1 parent a5fa9aa commit 7848bd8

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

unittest/python/test_BDCSVD.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
A = rng.random((dim, dim))
99
A = (A + A.T) * 0.5 + np.diag(10.0 + rng.random(dim))
1010

11-
bdcsvd = eigenpy.BDCSVD(
12-
A,
13-
eigenpy.DecompositionOptions.ComputeFullU
14-
| eigenpy.DecompositionOptions.ComputeFullV,
15-
)
11+
opt_U = eigenpy.DecompositionOptions.ComputeFullU
12+
opt_V = eigenpy.DecompositionOptions.ComputeFullV
13+
14+
bdcsvd = eigenpy.BDCSVD(A, opt_U | opt_V)
1615
assert bdcsvd.info() == eigenpy.ComputationInfo.Success
1716

1817
# Solve

unittest/python/test_JacobiSVD.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
A = rng.random((dim, dim))
99
A = (A + A.T) * 0.5 + np.diag(10.0 + rng.random(dim))
1010

11-
jacobisvd = eigenpy.JacobiSVD(A, 24)
11+
opt_U = eigenpy.DecompositionOptions.ComputeFullU
12+
opt_V = eigenpy.DecompositionOptions.ComputeFullV
13+
14+
jacobisvd = eigenpy.JacobiSVD(A, opt_U | opt_V)
15+
assert jacobisvd.info() == eigenpy.ComputationInfo.Success
1216

1317
# Solve
1418
X = rng.random((dim, 20))
@@ -30,6 +34,14 @@
3034
nonzerosingval = jacobisvd.nonzeroSingularValues()
3135
singularvalues = jacobisvd.singularValues()
3236

37+
S = np.diag(singularvalues)
38+
V_adj = V.conj().T
39+
assert eigenpy.is_approx(A, U @ S @ V_adj)
40+
3341
jacobisvd.setThreshold(1e-8)
3442
threshold = jacobisvd.threshold()
43+
44+
jacobisvd.setThreshold()
45+
threshold = jacobisvd.threshold()
46+
3547
rank = jacobisvd.rank()

0 commit comments

Comments
 (0)