Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lectures/svd_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ Let's do an example.
import numpy as np
import numpy.linalg as LA
import matplotlib.pyplot as plt

rng = np.random.default_rng()
```

Having imported these modules, let's do the example.
Expand Down Expand Up @@ -424,7 +426,7 @@ First, let's study a case in which $m = 5 > n = 2$.

```{code-cell} ipython3
import numpy as np
X = np.random.rand(5,2)
X = rng.random((5, 2))
U, S, V = np.linalg.svd(X,full_matrices=True) # full SVD
Uhat, Shat, Vhat = np.linalg.svd(X,full_matrices=False) # economy SVD
print('U, S, V =')
Expand Down Expand Up @@ -486,7 +488,7 @@ To illustrate this case, we'll set $m = 2 < 5 = n $ and compute both full and r

```{code-cell} ipython3
import numpy as np
X = np.random.rand(2,5)
X = rng.random((2, 5))
U, S, V = np.linalg.svd(X,full_matrices=True) # full SVD
Uhat, Shat, Vhat = np.linalg.svd(X,full_matrices=False) # economy SVD
print('U, S, V = ')
Expand Down
Loading