Skip to content

Commit 7a5ed80

Browse files
rossbarbsipocz
andcommitted
Rm duplicated import
Co-authored-by: Brigitta Sipőcz <b.sipocz@gmail.com>
1 parent 7f4b387 commit 7a5ed80

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

content/tutorial-svd.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ s @ Vt
201201
results in a `ValueError`. This happens because having a one-dimensional array for `s`, in this case, is much more economic in practice than building a diagonal matrix with the same data. To reconstruct the original matrix, we can rebuild the diagonal matrix $\Sigma$ with the elements of `s` in its diagonal and with the appropriate dimensions for multiplying: in our case, $\Sigma$ should be 768x1024 since `U` is 768x768 and `Vt` is 1024x1024. In order to add the singular values to the diagonal of `Sigma`, we will use the [fill_diagonal](https://numpy.org/devdocs/reference/generated/numpy.fill_diagonal.html) function from NumPy:
202202

203203
```{code-cell}
204-
import numpy as np
205-
206204
Sigma = np.zeros((U.shape[1], Vt.shape[0]))
207205
np.fill_diagonal(Sigma, s)
208206
```

0 commit comments

Comments
 (0)