File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ Now let's write some homemade Python code to implement a QR decomposition by dep
169169``` {code-cell} ipython3
170170import numpy as np
171171from scipy.linalg import qr
172+
173+ rng = np.random.default_rng()
172174```
173175
174176``` {code-cell} ipython3
@@ -354,7 +356,7 @@ Here goes
354356
355357``` {code-cell} ipython3
356358# experiment this with one random A matrix
357- A = np.random .random((3, 3))
359+ A = rng .random((3, 3))
358360```
359361
360362``` {code-cell} ipython3
@@ -396,14 +398,14 @@ k = 5
396398n = 1000
397399
398400# generate some random moments
399- 𝜇 = np.random .random(size=k)
400- C = np.random .random((k, k))
401+ 𝜇 = rng .random(size=k)
402+ C = rng .random((k, k))
401403Σ = C.T @ C
402404```
403405
404406``` {code-cell} ipython3
405407# X is random matrix where each column follows multivariate normal dist.
406- X = np.random .multivariate_normal(𝜇, Σ, size=n)
408+ X = rng .multivariate_normal(𝜇, Σ, size=n)
407409```
408410
409411``` {code-cell} ipython3
You can’t perform that action at this time.
0 commit comments