Skip to content

Commit 97cf445

Browse files
mmckyclaude
andauthored
[action-translation] resync: eig_circulant.md (#109)
* 🔄 resync eig_circulant.md * Restore trailing newline (engine issue tracked in QuantEcon/action-translation#116) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 8d5f799 commit 97cf445

2 files changed

Lines changed: 75 additions & 37 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source-sha: 6a512f1f2079665601fd77fad821c19a8c75b292
2+
synced-at: "2026-07-18"
3+
model: claude-sonnet-5
4+
mode: RESYNC
5+
section-count: 6
6+
tool-version: 0.17.0

lectures/eig_circulant.md

Lines changed: 69 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,35 @@ kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
1111
name: python3
12+
translation:
13+
title: 循环矩阵
14+
headings:
15+
Overview: 概述
16+
Constructing a Circulant Matrix: 构造循环矩阵
17+
Constructing a Circulant Matrix::Some Properties of Circulant Matrices: 循环矩阵的一些性质
18+
Connection to Permutation Matrix: 与置换矩阵的联系
19+
Examples with Python: Python示例
20+
Associated Permutation Matrix: 关联的置换矩阵
21+
Discrete Fourier Transform: 离散傅里叶变换
1222
---
1323

1424
# 循环矩阵
1525

1626
## 概述
1727

18-
本讲座将介绍循环矩阵这一特殊的矩阵类型
28+
本讲座将介绍循环矩阵及其一些性质
1929

20-
循环矩阵有着独特的结构特征,这使得它们与许多重要的数学概念密切相关,比如:
30+
循环矩阵之所以有用,是因为与它们相乘和卷积密切相关,并且它们的特征向量可以用离散傅里叶变换来构造。
31+
32+
我们用循环矩阵将几个有用的概念联系起来,包括
2133

2234
* 卷积运算
2335
* 傅里叶变换
2436
* 置换矩阵
2537

26-
正是由于这些重要联系,循环矩阵在机器学习等领域得到了广泛应用。例如,它们在图像处理中扮演着重要角色。
38+
关于特征值和特征向量的背景知识,请参见 {doc}`linear_algebra`;关于傅里叶变换和卷积的另一个应用,请参见 {doc}`hoist_failure`
39+
40+
循环矩阵在机器学习中也有广泛应用,例如在图像处理中。
2741

2842
我们首先导入一些Python包:
2943

@@ -62,13 +76,27 @@ c_{1} & c_{2} & c_{3} & c_{4} & c_{5} & \cdots & c_{0}
6276
\end{array}\right]
6377
$$ (eqn:circulant)
6478
79+
这个模式可以形式化如下。
80+
81+
```{prf:definition} 循环矩阵
82+
:label: def-circulant-matrix
83+
84+
一个 $N \times N$ 矩阵 $C$ 是**循环的**,如果存在数字 $c_0, \ldots, c_{N-1}$,使得
85+
86+
$$
87+
C_{ij} = c_{(j-i) \bmod N},
88+
\qquad 0 \leq i,j \leq N-1.
89+
$$
90+
91+
等价地,每一行都是通过将上一行的元素向右移动一位而得到的。
92+
```
93+
6594
也可以通过创建上述矩阵的转置来构造循环矩阵,在这种情况下只需要指定第一列。
6695
6796
让我们编写一些Python代码来生成循环矩阵:
6897
6998
```{code-cell} ipython3
70-
@jit
71-
def construct_cirlulant(row):
99+
def construct_circulant(row):
72100
73101
N = row.size
74102
@@ -84,19 +112,22 @@ def construct_cirlulant(row):
84112
85113
```{code-cell} ipython3
86114
# 当 N = 3 时的一个简单例子
87-
construct_cirlulant(np.array([1., 2., 3.]))
115+
construct_circulant(np.array([1., 2., 3.]))
88116
```
89117
90118
### 循环矩阵的一些性质
91119
92-
以下是一些有用的性质。
120+
以下是一些有用的性质:
121+
122+
假设 $A$ 和 $B$ 都是同阶的循环矩阵,并且采用相同的循环移位约定构造。
93123
94-
假设 $A$ 和 $B$ 都是循环矩阵。那么可以验证:
124+
那么可以验证:
95125
96126
* 循环矩阵的转置是循环矩阵
97-
* $A + B$ 是循环矩阵
98-
* $A B$ 是循环矩阵
99-
* $A B = B A$
127+
128+
* $A + B$ 是循环矩阵
129+
* $A B$ 是循环矩阵
130+
* $A B = B A$
100131
101132
现在考虑一个第一行为
102133
@@ -109,16 +140,18 @@ construct_cirlulant(np.array([1., 2., 3.]))
109140
向量 $c$ 和 $a$ 的**卷积**定义为向量 $b = c * a $,其分量为
110141

111142
$$
112-
b_k = \sum_{i=0}^{n-1} c_{k-i} a_i
143+
b_k = \sum_{i=0}^{N-1} c_{k-i} a_i
113144
$$ (eqn:conv)
114145
146+
这里以及下文中,诸如 $k-i$ 之类的下标都按模 $N$ 来理解。
147+
115148
我们使用 $*$ 来表示通过方程 {eq}`eqn:conv` 描述的**卷积**计算。
116149
117150
可以验证向量 $b$ 满足
118151
119-
$$ b = C^T a $$
152+
$$ b = C^\top a $$
120153

121-
其中 $C^T$ 是方程 {eq}`eqn:circulant` 中定义的循环矩阵的转置。
154+
其中 $C^\top$ 是方程 {eq}`eqn:circulant` 中定义的循环矩阵的转置。
122155

123156
## 与置换矩阵的联系
124157

@@ -167,7 +200,7 @@ $$
167200
并求解
168201
169202
$$
170-
\textrm{det}(P - \lambda I) = (-1)^N \lambda^{N}-1=0
203+
\textrm{det}(P - \lambda I) = (-1)^N(\lambda^N - 1)=0
171204
$$
172205
173206
来计算。
@@ -181,16 +214,15 @@ $$
181214
可以验证置换矩阵是正交矩阵:
182215
183216
$$
184-
P P' = I
217+
P P^\top = I
185218
$$
186219
187220
## Python示例
188221
189222
让我们编写一些Python代码来说明这些概念:
190223
191224
```{code-cell} ipython3
192-
@jit
193-
def construct_P(N):
225+
def construct_cyclic_shift_matrix(N):
194226
195227
P = np.zeros((N, N))
196228
@@ -202,7 +234,7 @@ def construct_P(N):
202234
```
203235
204236
```{code-cell} ipython3
205-
P4 = construct_P(4)
237+
P4 = construct_cyclic_shift_matrix(4)
206238
P4
207239
```
208240
@@ -213,16 +245,16 @@ P4
213245
214246
```{code-cell} ipython3
215247
for i in range(4):
216-
print(f'𝜆{i} = {𝜆[i]:.1f} \nvec{i} = {Q[i, :]}\n')
248+
print(f'𝜆{i} = {𝜆[i]:.1f} \nvec{i} = {Q[:, i]}\n')
217249
```
218250
219-
让我们在复平面上绘制移位置换矩阵的特征值
251+
在下面的图中,我们将在复平面上描绘移位置换矩阵的特征值
220252
221-
从图中可以看出,这些特征值在单位圆上均匀分布。
253+
这些特征值在单位圆上均匀分布。
222254
223-
这些特征值实际上就是单位根 -- 即满足方程 $z^n = 1$ 的复数 $z$
255+
它们是**$n$ 个单位根**,也就是说,它们是满足 $z^n =1$ 的 $n$ 个数 $z$,其中 $z$ 是复数
224256
225-
具体来说,对于阶数为 $n$ 的置换矩阵,其特征值就是 $n$ 个单位根,它们的表达式为
257+
具体来说,$n$ 个单位根为
226258
227259
$$
228260
z = \exp\left(\frac{2 \pi j k }{N} \right) , \quad k = 0, \ldots, N-1
@@ -238,7 +270,7 @@ for i, N in enumerate([3, 4, 6, 8]):
238270
row_i = i // 2
239271
col_i = i % 2
240272
241-
P = construct_P(N)
273+
P = construct_cyclic_shift_matrix(N)
242274
𝜆, Q = np.linalg.eig(P)
243275
244276
circ = plt.Circle((0, 0), radius=1, edgecolor='b', facecolor='None')
@@ -317,14 +349,14 @@ Q8 = F8 / np.sqrt(8)
317349
```
318350
319351
```{code-cell} ipython3
320-
# 验证正交性
352+
# 验证正交性(酉性)
321353
Q8 @ np.conjugate(Q8)
322354
```
323355
324356
让我们验证 $Q_{8}$ 的第 $k$ 列是 $P_{8}$ 的特征向量,对应的特征值是 $w^{k}$。
325357
326358
```{code-cell} ipython3
327-
P8 = construct_P(8)
359+
P8 = construct_cyclic_shift_matrix(8)
328360
```
329361
330362
```{code-cell} ipython3
@@ -338,12 +370,12 @@ for j in range(8):
338370
diff_arr
339371
```
340372
341-
## 循环矩阵与置换矩阵的关系
373+
## 关联的置换矩阵
342374
343-
接下来,我们将验证方程 {eq}`eqn:circulant` 中定义的循环矩阵 $C$ 可以表示为置换矩阵的线性组合:
375+
接下来,我们进行计算以验证方程 {eq}`eqn:circulant` 中定义的循环矩阵 $C$ 可以写成
344376
345377
$$
346-
C = c_{0} I + c_{1} P + \cdots + c_{n-1} P^{n-1}
378+
C = c_{0} I + c_{1} P + \cdots + c_{N-1} P^{N-1}
347379
$$
348380
349381
并且 $P$ 的每个特征向量也是 $C$ 的特征向量。
@@ -359,10 +391,10 @@ c
359391
```
360392
361393
```{code-cell} ipython3
362-
C8 = construct_cirlulant(c)
394+
C8 = construct_circulant(c)
363395
```
364396
365-
计算 $c_{0} I + c_{1} P + \cdots + c_{n-1} P^{n-1}$
397+
计算 $c_{0} I + c_{1} P + \cdots + c_{N-1} P^{N-1}$
366398
367399
```{code-cell} ipython3
368400
N = 8
@@ -389,7 +421,7 @@ C8
389421
np.abs(C - C8).max()
390422
```
391423
392-
$P_8$ 的第 $k$ 列是 $C_8$ 的特征向量,其特征值为 $\sum_{h=0}^{7} c_h w^{hk}$,其中 $w^{k-1}$ 是 $P_8$ 对应的特征值
424+
$Q_{8}$ 的第 $j$ 列是 $C_{8}$ 的特征向量,其关联的特征值为 $\sum_{k=0}^{7} c_k w^{j k}$
393425
394426
```{code-cell} ipython3
395427
𝜆_C8 = np.zeros(8, dtype=complex)
@@ -482,7 +514,7 @@ def plot_magnitude(x=None, X=None):
482514
if (X is not None):
483515
data.append(X)
484516
names.append('X')
485-
xs.append('j')
517+
xs.append('k')
486518
487519
num = len(data)
488520
for i in range(num):
@@ -510,7 +542,7 @@ x_{n} = \sum_{k=0}^{N-1} \frac{1}{N} X_{k} e^{2\pi\left(\frac{kn}{N}\right)i}, \
510542
$$
511543
512544
```{code-cell} ipython3
513-
def inverse_transform(X):
545+
def inverse_DFT(X):
514546
515547
N = len(X)
516548
w = np.e ** (complex(0, 2*np.pi/N))
@@ -524,7 +556,7 @@ def inverse_transform(X):
524556
```
525557
526558
```{code-cell} ipython3
527-
inverse_transform(X)
559+
inverse_DFT(X)
528560
```
529561
530562
另一个例子是
@@ -613,4 +645,4 @@ F20 @ x
613645
```{code-cell} ipython3
614646
F20_inv = np.linalg.inv(F20)
615647
F20_inv @ X
616-
```
648+
```

0 commit comments

Comments
 (0)