Skip to content

Commit 509030e

Browse files
committed
Merge branch 'main' into svd
2 parents 8b75eaf + 9ec9e13 commit 509030e

36 files changed

+157
-267
lines changed

.github/workflows/cache.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
cache:
88
runs-on: quantecon-gpu-runner
99
container:
10-
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-06-py312
10+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312
1111
options: --gpus all
1212
steps:
1313
- uses: actions/checkout@v4
@@ -31,4 +31,5 @@ jobs:
3131
uses: actions/upload-artifact@v4
3232
with:
3333
name: build-cache
34-
path: _build
34+
path: _build
35+
include-hidden-files: true

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
preview:
55
runs-on: quantecon-gpu-runner
66
container:
7-
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-06-py312
7+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312
88
options: --gpus all
99
steps:
1010
- uses: actions/checkout@v4

.github/workflows/execution.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
99
runs-on: quantecon-gpu-runner
1010
container:
11-
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-06-py312
11+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312
1212
options: --gpus all
1313
steps:
1414
- name: Checkout

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ channels:
33
- default
44
dependencies:
55
- python=3.12
6-
- anaconda=2024.06
6+
- anaconda=2024.10
77
- pip
88
- pip:
99
- jupyter-book==0.15.1
1010
- docutils==0.17.1
11-
- quantecon-book-theme==0.7.1
11+
- quantecon-book-theme==0.7.2
1212
- sphinx-reredirects==0.1.3
1313
- sphinx-tojupyter==0.3.0
1414
- sphinxext-rediraffe==0.2.7

lectures/aiyagari.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class Household:
283283
284284
# Do the hard work using JIT-ed functions
285285
286-
@jit(nopython=True)
286+
@jit
287287
def populate_R(R, a_size, z_size, a_vals, z_vals, r, w):
288288
n = a_size * z_size
289289
for s_i in range(n):
@@ -297,7 +297,7 @@ def populate_R(R, a_size, z_size, a_vals, z_vals, r, w):
297297
if c > 0:
298298
R[s_i, new_a_i] = np.log(c) # Utility
299299
300-
@jit(nopython=True)
300+
@jit
301301
def populate_Q(Q, a_size, z_size, Π):
302302
n = a_size * z_size
303303
for s_i in range(n):
@@ -307,7 +307,7 @@ def populate_Q(Q, a_size, z_size, Π):
307307
Q[s_i, a_i, a_i*z_size + next_z_i] = Π[z_i, next_z_i]
308308
309309
310-
@jit(nopython=True)
310+
@jit
311311
def asset_marginal(s_probs, a_size, z_size):
312312
a_probs = np.zeros(a_size)
313313
for a_i in range(a_size):

lectures/ak2.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ $$
408408
```{code-cell} ipython3
409409
import numpy as np
410410
import matplotlib.pyplot as plt
411-
from numba import njit
411+
from numba import jit
412412
from quantecon.optimize import brent_max
413413
```
414414
@@ -433,22 +433,22 @@ Knowing $\hat K$, we can calculate other equilibrium objects.
433433
Let's first define some Python helper functions.
434434
435435
```{code-cell} ipython3
436-
@njit
436+
@jit
437437
def K_to_Y(K, α):
438438
439439
return K ** α
440440
441-
@njit
441+
@jit
442442
def K_to_r(K, α):
443443
444444
return α * K ** (α - 1)
445445
446-
@njit
446+
@jit
447447
def K_to_W(K, α):
448448
449449
return (1 - α) * K ** α
450450
451-
@njit
451+
@jit
452452
def K_to_C(K, D, τ, r, α, β):
453453
454454
# optimal consumption for the old when δ=0
@@ -913,7 +913,7 @@ Let's implement this "guess and verify" approach
913913
We start by defining the Cobb-Douglas utility function
914914
915915
```{code-cell} ipython3
916-
@njit
916+
@jit
917917
def U(Cy, Co, β):
918918
919919
return (Cy ** β) * (Co ** (1-β))
@@ -924,7 +924,7 @@ We use `Cy_val` to compute the lifetime value of an arbitrary consumption plan,
924924
Note that it requires knowing future prices $r_{t+1}$ and tax rate $\tau_{t+1}$.
925925
926926
```{code-cell} ipython3
927-
@njit
927+
@jit
928928
def Cy_val(Cy, W, r_next, τ, τ_next, δy, δo_next, β):
929929
930930
# Co given by the budget constraint

lectures/career.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import matplotlib.pyplot as plt
5151
plt.rcParams["figure.figsize"] = (11, 5) #set default figure size
5252
import numpy as np
5353
import quantecon as qe
54-
from numba import njit, prange
54+
from numba import jit, prange
5555
from quantecon.distributions import BetaBinomial
5656
from scipy.special import binom, beta
5757
from mpl_toolkits.mplot3d.axes3d import Axes3D
@@ -234,7 +234,7 @@ def operator_factory(cw, parallel_flag=True):
234234
F_probs, G_probs = cw.F_probs, cw.G_probs
235235
F_mean, G_mean = cw.F_mean, cw.G_mean
236236
237-
@njit(parallel=parallel_flag)
237+
@jit(parallel=parallel_flag)
238238
def T(v):
239239
"The Bellman operator"
240240
@@ -249,7 +249,7 @@ def operator_factory(cw, parallel_flag=True):
249249
250250
return v_new
251251
252-
@njit
252+
@jit
253253
def get_greedy(v):
254254
"Computes the v-greedy policy"
255255
@@ -472,7 +472,7 @@ T, get_greedy = operator_factory(cw)
472472
v_star = solve_model(cw, verbose=False)
473473
greedy_star = get_greedy(v_star)
474474
475-
@njit
475+
@jit
476476
def passage_time(optimal_policy, F, G):
477477
t = 0
478478
i = j = 0
@@ -485,7 +485,7 @@ def passage_time(optimal_policy, F, G):
485485
i, j = qe.random.draw(F), qe.random.draw(G)
486486
t += 1
487487
488-
@njit(parallel=True)
488+
@jit(parallel=True)
489489
def median_time(optimal_policy, F, G, M=25000):
490490
samples = np.empty(M)
491491
for i in prange(M):

lectures/cass_koopmans_1.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.1
7+
jupytext_version: 1.16.4
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -66,7 +66,7 @@ Let's start with some standard imports:
6666

6767
```{code-cell} ipython3
6868
import matplotlib.pyplot as plt
69-
from numba import njit, float64
69+
from numba import jit, float64
7070
from numba.experimental import jitclass
7171
import numpy as np
7272
from quantecon.optimize import brentq
@@ -525,7 +525,7 @@ planning problem.
525525
$c_0$ instead of $\mu_0$ in the following code.)
526526
527527
```{code-cell} ipython3
528-
@njit
528+
@jit
529529
def shooting(pp, c0, k0, T=10):
530530
'''
531531
Given the initial condition of capital k0 and an initial guess
@@ -610,7 +610,7 @@ When $K_{T+1}$ gets close enough to $0$ (i.e., within an error
610610
tolerance bounds), we stop.
611611
612612
```{code-cell} ipython3
613-
@njit
613+
@jit
614614
def bisection(pp, c0, k0, T=10, tol=1e-4, max_iter=500, k_ter=0, verbose=True):
615615
616616
# initial boundaries for guess c0
@@ -804,7 +804,7 @@ over time.
804804
Let's calculate and plot the saving rate.
805805
806806
```{code-cell} ipython3
807-
@njit
807+
@jit
808808
def saving_rate(pp, c_path, k_path):
809809
'Given paths of c and k, computes the path of saving rate.'
810810
production = pp.f(k_path[:-1])
@@ -912,7 +912,7 @@ $$ (eq:tildeC)
912912
A positive fixed point $C = \tilde C(K)$ exists only if $f\left(K\right)+\left(1-\delta\right)K-f^{\prime-1}\left(\frac{1}{\beta}-\left(1-\delta\right)\right)>0$
913913
914914
```{code-cell} ipython3
915-
@njit
915+
@jit
916916
def C_tilde(K, pp):
917917
918918
return pp.f(K) + (1 - pp.δ) * K - pp.f_prime_inv(1 / pp.β - 1 + pp.δ)
@@ -931,11 +931,11 @@ K = \tilde K(C)
931931
$$ (eq:tildeK)
932932
933933
```{code-cell} ipython3
934-
@njit
934+
@jit
935935
def K_diff(K, C, pp):
936936
return pp.f(K) - pp.δ * K - C
937937
938-
@njit
938+
@jit
939939
def K_tilde(C, pp):
940940
941941
res = brentq(K_diff, 1e-6, 100, args=(C, pp))
@@ -951,7 +951,7 @@ It is thus the intersection of the two curves $\tilde{C}$ and $\tilde{K}$ that w
951951
We can compute $K_s$ by solving the equation $K_s = \tilde{K}\left(\tilde{C}\left(K_s\right)\right)$
952952
953953
```{code-cell} ipython3
954-
@njit
954+
@jit
955955
def K_tilde_diff(K, pp):
956956
957957
K_out = K_tilde(C_tilde(K, pp), pp)
@@ -1003,7 +1003,7 @@ In addition to the three curves, Figure {numref}`stable_manifold` plots arrows
10031003
---
10041004
mystnb:
10051005
figure:
1006-
caption: "Stable Manifold and Phase Plane"
1006+
caption: Stable Manifold and Phase Plane
10071007
name: stable_manifold
10081008
tags: [hide-input]
10091009
---

0 commit comments

Comments
 (0)