Skip to content

Commit cef025d

Browse files
CopilotJutho
andcommitted
Use svd_vals to verify truncation error equals discarded singular values
Co-authored-by: Jutho <[email protected]>
1 parent 6069be6 commit cef025d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

docs/src/user_interface/truncations.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ julia> size(U)
149149
julia> size(Vh)
150150
(2, 3)
151151
152-
julia> # Verify the truncated decomposition approximates the original
153-
reconstruction_error = norm(B - U * S * Vh);
154-
155-
julia> reconstruction_error < 2.1 # Error is small (equals smallest discarded singular value)
152+
julia> # Verify the truncated decomposition error equals the discarded singular values
153+
norm(B - U * S * Vh) ≈ norm(svd_vals(B)[3:end])
156154
true
157155
```
158156

0 commit comments

Comments
 (0)