Skip to content

Commit 1fd8130

Browse files
authored
Merge branch 'main' into kesten_jax
2 parents f28b8eb + 81cd6a3 commit 1fd8130

File tree

7 files changed

+569
-75
lines changed

7 files changed

+569
-75
lines changed

lectures/finite_markov.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,9 +1278,8 @@ n = 14 # Total number of web pages (nodes)
12781278
# * Q[i, j] = 1 if there is a link from i to j
12791279
# * Q[i, j] = 0 otherwise
12801280
Q = np.zeros((n, n), dtype=int)
1281-
f = open(infile, 'r')
1282-
edges = f.readlines()
1283-
f.close()
1281+
with open(infile) as f:
1282+
edges = f.readlines()
12841283
for edge in edges:
12851284
from_node, to_node = re.findall('\w', edge)
12861285
i, j = alphabet.index(from_node), alphabet.index(to_node)

lectures/prob_matrix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import numpy as np
4545
import matplotlib.pyplot as plt
4646
import prettytable as pt
4747
from mpl_toolkits.mplot3d import Axes3D
48-
from IPython.display import set_matplotlib_formats
48+
from matplotlib_inline.backend_inline import set_matplotlib_formats
4949
set_matplotlib_formats('retina')
5050
%matplotlib inline
5151
```

lectures/qr_decomp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ XX = X.T @ X
440440
Λ_hat = np.diag(𝜆_hat)
441441
```
442442

443-
Compare the eigenvalues which are on the diagnoals of $\Lambda$ and $\hat{\Lambda}$.
443+
Compare the eigenvalues that are on the diagonals of $\Lambda$ and $\hat{\Lambda}$.
444444

445445
```{code-cell} ipython3
446446
𝜆, 𝜆_hat

lectures/short_path.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,19 +399,17 @@ def map_graph_to_distance_matrix(in_file):
399399
Q = np.full((num_nodes, num_nodes), np.inf)
400400
401401
# Now we read in the data and modify Q
402-
infile = open(in_file)
403-
for line in infile:
404-
elements = line.split(',')
405-
node = elements.pop(0)
406-
node = int(node[4:]) # convert node description to integer
407-
if node != destination_node:
408-
for element in elements:
409-
destination, cost = element.split()
410-
destination = int(destination[4:])
411-
Q[node, destination] = float(cost)
412-
Q[destination_node, destination_node] = 0
413-
414-
infile.close()
402+
with open(in_file) as infile:
403+
for line in infile:
404+
elements = line.split(',')
405+
node = elements.pop(0)
406+
node = int(node[4:]) # convert node description to integer
407+
if node != destination_node:
408+
for element in elements:
409+
destination, cost = element.split()
410+
destination = int(destination[4:])
411+
Q[node, destination] = float(cost)
412+
Q[destination_node, destination_node] = 0
415413
return Q
416414
```
417415

lectures/status.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ This table contains the latest execution statistics.
1818

1919
(status:machine-details)=
2020

21-
These lectures are built on `linux` instances through `github actions` and `amazon web services (aws)` to
21+
These lectures are built on `linux` instances through `github actions` and `amazon web services (aws)` to
2222
enable access to a `gpu`. These lectures are built on a [p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/)
23-
that has access to `8 vcpu's`, a `V100 NVIDIA Tesla GPU`, and `61 Gb` of memory.
23+
that has access to `8 vcpu's`, a `V100 NVIDIA Tesla GPU`, and `61 Gb` of memory.

0 commit comments

Comments
 (0)