# 循环卷积

循环卷积是一种数学运算，它将两个周期为 N 的有限序列进行卷积，采用回绕索引，即任何落在 0, …, N−1 之外的索引都按模 N 取值。它与普通的线性卷积不同——线性卷积产生一个更长的输出且没有回绕——循环卷积之所以重要，是因为离散傅里叶变换（DFT）将它转化为逐点乘法，从而通过快速傅里叶变换（FFT）给出一个 \( O(N \log N) \) 的卷积算法。<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup><sup> • </sup><sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup><sup> • </sup><sup>[3](https://web.stanford.edu/class/archive/cs/cs339/cs339.2002/fft.pdf)</sup>

| 关键事实 | 值 |
|---|---|
| 定义求和式 | \( y[n] = \sum_{k=0}^{K-1} h[k] \cdot x[(n-k) \bmod N] \)<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup> |
| 卷积定理 | 对于长度为 N 的序列，\( Y[m] = H[m] \cdot X[m] \)<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup> |
| 输出长度 | 线性：\( L + M - 1 \)，无回绕；循环：\( N \)，有回绕<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup> |
| 精确性条件 | 将两个序列零填充至 \( N \geq L + M - 1 \)<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup> |
| 直接计算代价 | \( N^{2} \) 次乘法与 \( N \cdot (N-1) \) 次加法，\( O(N^{2}) \)<sup>[4](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Signals_and_Systems_%28Baraniuk_et_al.%29/07%3A_Discrete_Time_Fourier_Series_%28DTFS%29/7.05%3A_Discrete_Time_Circular_Convolution_and_the_DTFS)</sup> |
| FFT 代价 | 三次 \( O(N \log N) \) 变换加一次 \( O(N) \) 逐点乘积<sup>[5](https://www.cs.cmu.edu/~15322/book/ch09/03.html)</sup> |
| 与直接法相比的盈亏平衡点 | 在 CPU 上大致为 \( N > 100 \)；在 GPU 上为数千个抽头<sup>[6](https://ccrma.stanford.edu/~jos/dft/Convolution_Theorem.html)</sup><sup> • </sup><sup>[7](https://ccrma.stanford.edu/%7Ejos/sasp/FFT_versus_Direct_Convolution.html)</sup> |

## 工作原理

长度为 N 的信号 x 与长度为 K 的冲激响应 h 的循环卷积定义为 \( y[n] = \sum_{k=0}^{K-1} h[k] \cdot x[(n-k) \bmod N] \)。它与线性卷积完全相同，只是负的样本索引会回绕到信号的末尾。<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup> 这一运算的产生，是因为两个周期 DFT 相乘需要一个结果保持在 n = 0, …, N−1 范围内的卷积；将 DFT 相乘 \( Y[k] = F[k]H[k] \) 在时域中恰好对应于这种模索引求和。<sup>[4](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Signals_and_Systems_%28Baraniuk_et_al.%29/07%3A_Discrete_Time_Fourier_Series_%28DTFS%29/7.05%3A_Discrete_Time_Circular_Convolution_and_the_DTFS)</sup>

回绕索引正是其全部区别性特征，并且它产生了使该运算有用的定理：对于长度为 N 的序列 h 和 x，其循环卷积为 y = h ⋆ x，卷积的 DFT 等于 DFT 的乘积，\( Y[m] = H[m] \cdot X[m] \)。<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup> 对偶命题同样成立：时域中的逐元素乘法等于频域中 DFT 的循环卷积乘以 \( (1/N) \)。<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup>

三种代数视角解释了其原因。将向量与循环矩阵 \( C_{a} \) 相乘等价于与定义该矩阵的向量 a 进行循环卷积；\( C_{a} \) 的特征值恰好是 a 的 DFT，因此 DFT 就是同时对角化所有循环矩阵的基变换，将卷积转化为分量式乘法。<sup>[8](https://ar5iv.labs.arxiv.org/html/1805.05533)</sup> 用多项式来说，循环卷积是多项式模 sⁿ − 1 化简后的乘法，H ∗_circ X ↔ H(s)X(s) mod (sⁿ − 1)，而 DFT 在 N 次单位根处求多项式的值，这些根恰好是 sⁿ − 1 的根。<sup>[9](https://spiral.ece.cmu.edu/pub-smart/pubfile/aspfft_38.pdf)</sup> 循环卷积也可以理解为线性卷积后跟时域混叠，即长度超过 N 的输出样本折叠回起始位置。<sup>[10](https://ocw.mit.edu/courses/res-6-008-digital-signal-processing-spring-2011/610905d8154ec2bfc090cf78022249a5_MITRES_6_008S11_lec10.pdf)</sup>

## 如何实现

对两个 N 点序列按定义公式直接求和，每个输出点需要 \( N \) 次乘法和 \( N-1 \) 次加法，即总共 \( N^{2} \) 次乘法和 \( N \cdot (N-1) \) 次加法。<sup>[4](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Signals_and_Systems_%28Baraniuk_et_al.%29/07%3A_Discrete_Time_Fourier_Series_%28DTFS%29/7.05%3A_Discrete_Time_Circular_Convolution_and_the_DTFS)</sup> FFT 路线计算 \( \mathrm{IDFT}(\mathrm{DFT}(h) \cdot \mathrm{DFT}(x)) \)：两次正向变换、一次仅需 \( O(N) \) 的逐样本乘法、一次逆变换，每次变换为 \( O(N \log N) \)。<sup>[5](https://www.cs.cmu.edu/~15322/book/ch09/03.html)</sup>

要利用这套机制获得线性（非循环）卷积，需在变换前将两个序列零填充至至少 \( N \geq L + M - 1 \)；此时回绕项贡献为零，循环结果等于线性结果。<sup>[11](https://courses.grainger.illinois.edu/ece401/fa2024/slides/lec24.pdf)</sup><sup> • </sup><sup>[12](https://www.cise.ufl.edu/~ritter/cap4410/Resources/dft.pdf)</sup> 使用基-2 FFT 时，N 向上取整到下一个 2 的幂；将 128 样本块与 32 抽头 FIR 核卷积需要 \( N \geq 159 \)，因此使用 \( N = 256 \)。<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup>

加速是真实的，但依赖于长度：一项基准测试发现 FFT 从长度 64 起就更快，而已发表的指南建议仅在相当长的卷积（如 \( N > 100 \)）时才依赖它，因为交叉点取决于硬件、实现和序列长度。<sup>[6](https://ccrma.stanford.edu/~jos/dft/Convolution_Theorem.html)</sup> 当 h 远短于信号时，代价为 \( N \cdot K \) 步的直接卷积仍可能胜出，scipy.signal.convolve 等库会比较长度来选择方法。<sup>[1](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)</sup>

## 起源

没有已发表的文献指出循环卷积定理本身首次正式陈述的具体人物、论文或年份；有据可查的谱系涉及使该定理实用的 DFT 和 FFT。FFT 作为一种机器算法由詹姆斯·W·库利（James W. Cooley）和约翰·W·图基（John W. Tukey）于 1965 年在《计算数学》（Mathematics of Computation）上发表，表明复傅里叶级数可以在少于 \( 2N \log_{2} N \) 次运算内计算，而非 \( N^{2} \) 次。<sup>[13](https://doi.org/10.1090/s0025-5718-1965-0178586-1)</sup> 他们的论文将一种交互算法——本身是耶茨（Yates）析因分析方法的推广——列为启发性先前工作。<sup>[13](https://doi.org/10.1090/s0025-5718-1965-0178586-1)</sup> 一旦 FFT 出现，DFT 域乘法便成为卷积的标准快速路线，默认是循环的，零填充后则是线性的。<sup>[3](https://web.stanford.edu/class/archive/cs/cs339/cs339.2002/fft.pdf)</sup>

## 变体

**模 N 循环卷积**是基本情况：商环 F[X]/(Xⁿ − 1) 中的多项式乘法，三个序列长度均为 n，索引按模 n 取值。<sup>[14](https://xn--2-umb.com/23/convolution/)</sup> **斜循环（负循环）卷积**则将乘积模 Xⁿ + 1 化简，因此第二个序列每个周期改变符号；H.K. 加格（H.K. Garg）于 1996 年在《电子学快报》（Electronics Letters）上发表了在有限整数环及其复数扩展上计算斜循环卷积的算法，建立在他早先将数论变换推广用于快速循环卷积的工作之上。<sup>[15](https://doi.org/10.1049/el:19961503)</sup>

**循环互相关**通过相同的 FFT 路线计算（对其中一个变换取共轭，相乘，逆变换），但在短缓冲区上，循环回绕会使缓冲区边缘附近的延迟估计不可靠，除非加入零填充。<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup> 对于长信号或流式信号，循环性不是被消除而是被利用：在**重叠相加**法中，每个输入块被零填充、变换，每个输出块重叠的尾部加到下一个块上；在**重叠保留**法中，从前一块保留额外的输入样本，使循环回绕只丢弃混叠的前缀。<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup><sup> • </sup><sup>[12](https://www.cise.ufl.edu/~ritter/cap4410/Resources/dft.pdf)</sup><sup> • </sup><sup>[10](https://ocw.mit.edu/courses/res-6-008-digital-signal-processing-spring-2011/610905d8154ec2bfc090cf78022249a5_MITRES_6_008S11_lec10.pdf)</sup>

## 应用

在数字信号处理中，通过相乘再逆变换的基于 DFT 的滤波是实现 FIR 滤波器的标准方式，重叠相加法和重叠保留法处理任意长的输入。<sup>[10](https://ocw.mit.edu/courses/res-6-008-digital-signal-processing-spring-2011/610905d8154ec2bfc090cf78022249a5_MITRES_6_008S11_lec10.pdf)</sup> 由于循环卷积是模 xᴺ − 1 的多项式乘法，它也可直接作为该环中的快速多项式算术。<sup>[9](https://spiral.ece.cmu.edu/pub-smart/pubfile/aspfft_38.pdf)</sup> 在某些应用中，周期性恰恰是所需要的：水印、扩频调制、某些快速相关技术，以及处理真正周期性的信号。<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup>

机器学习已将这一运算采纳为层：卷积定理使循环注意力乘积 circ(Z⋆)V 能以 IFFT(FFT(Z⋆) ⊙ FFT(V)) 在 O(N log N) 而非 O(N²) 注意力代价下计算，<sup>[16](https://papers.nips.cc/paper_files/paper/2025/file/d9f8b5abc8e0926539ecbb492af7b2f1-Paper-Conference.pdf)</sup> 基于 FFT 的所有核大小的逐通道卷积以 \( O(L \log L) \) 运行，<sup>[17](https://proceedings.neurips.cc/paper_files/paper/2024/file/2f9ee101e35b890d9eae79ee27bcd69a-Paper-Conference.pdf)</sup> 而注意力推理中的 \( \mathrm{conv}(a) \cdot x \) 通过 FFT 计算。在硬件方面，FlashButterfly 使用蝶形分解将整个 FFT 卷积融合为单个 GPU 内核，因为即使 cuFFT 在序列无法放入 SRAM 时也必须对输入进行多趟处理。<sup>[18](https://arxiv.org/pdf/2302.06646v1.pdf)</sup> FlashFFTConv 更进一步，采用 FFT 的 Monarch 分解，将其重写为一系列矩阵-矩阵乘法以利用 H100 张量核心，并可扩展到从 256 到 400 万的序列长度。<sup>[19](https://proceedings.iclr.cc/paper_files/paper/2024/file/281190d87732639e63bc19dedd7d711b-Paper-Conference.pdf)</sup>

## 局限与替代方案

**循环混叠**是主要的失效模式：当 \( N < L + M - 1 \) 时用 N 点 FFT 执行每次 DFT，会返回循环卷积结果而非预期的线性卷积，这是 FIR 滤波器实现和相关运算中微妙错误的常见来源；修复方法是将两个序列零填充至至少 \( L + M - 1 \)。<sup>[2](https://www.dsprelated.com/glossary/circular-conv)</sup> 从周期卷积中去除额外混叠项以产生线性卷积称为去混叠，隐式去混叠公式利用已知的零值而无需显式填充。<sup>[20](https://malcolmroberts.github.io/publications/roberts_bowman_cse1015.pdf)</sup><sup> • </sup><sup>[21](http://www.math.ualberta.ca/~bowman/publications/hybrid.pdf)</sup>

**浮点误差与内存**是第二项代价。基于 FFT 的卷积受舍入误差影响；通过 FFT 卷积计算二项式系数得到 6.999999999999998，而直接卷积给出精确整数，且 FFT 路线因填充和复数运算需要显著更多内存，重叠相加技术可以减少内存。<sup>[22](https://blogs.mathworks.com/steve/2009/11/03/the-conv-function-and-implementation-tradeoffs/)</sup> 对于大 N，直接求和与 FFT 路线具有不同的舍入误差行为，两者都不绝对更精确；相对误差取决于数据、条件数和实现。<sup>[20](https://malcolmroberts.github.io/publications/roberts_bowman_cse1015.pdf)</sup>

**盈亏平衡规模依赖于平台**，已发表的指南存在分歧：在 CPU 上 FFT 在 \( N > 100 \) 左右划算（一项基准测试发现从长度 64 起更快），<sup>[6](https://ccrma.stanford.edu/~jos/dft/Convolution_Theorem.html)</sup> 而在 GPU 上，大规模并行硬件快速执行 \( O(N^{2}) \) 算法，FFT 卷积仅在数千抽头的 FIR 滤波器上胜出。<sup>[7](https://ccrma.stanford.edu/%7Ejos/sasp/FFT_versus_Direct_Convolution.html)</sup> **算法替代方案**包括保持循环卷积性质的数论变换；阿加瓦尔（Agarwal）和伯鲁斯（Burrus）在其实现中表明 NTT 比 FFT 更快，而钱德拉（Chandra）的现代 NTT 实现优于 FFTW 库。<sup>[23](https://ar5iv.labs.arxiv.org/html/1005.1497)</sup> 维诺格拉德（Winograd）卷积通过中国剩余定理推广 Toom-Cook 算法，用模 Xⁿ − 1 恢复循环卷积、用 Xⁿ + 1 恢复负循环卷积，选择求值点 {0, 1, −1} 得到 Karatsuba 算法；这些方法与 FFT 卷积的针对特定工作负载的比较已有发表，但其测得的盈亏平衡点取决于硬件、规模和实现，因此不存在通用的盈亏平衡规模。

## References

1. [10.1. The Convolution Theorem, Digital Signals Theory (Brian McFee)](https://brianmcfee.net/dstbook-site/content/ch10-convtheorem/ConvolutionTheorem.html)
2. [Circular Convolution, DSP Glossary | DSPRelated](https://www.dsprelated.com/glossary/circular-conv)
3. [The FFT: An Algorithm the Whole Family Can Use](https://web.stanford.edu/class/archive/cs/cs339/cs339.2002/fft.pdf)
4. [7.05: Discrete Time Circular Convolution and the DTFS (eng.libretexts.org)](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Signals_and_Systems_%28Baraniuk_et_al.%29/07%3A_Discrete_Time_Fourier_Series_%28DTFS%29/7.05%3A_Discrete_Time_Circular_Convolution_and_the_DTFS)
5. [9.3 The convolution theorem, CMU Intro to Computer Music](https://www.cs.cmu.edu/~15322/book/ch09/03.html)
6. [Convolution Theorem (Mathematics of the DFT, Julius O. Smith, CCRMA Stanford)](https://ccrma.stanford.edu/~jos/dft/Convolution_Theorem.html)
7. [FFT versus Direct Convolution (Stanford CCRMA)](https://ccrma.stanford.edu/%7Ejos/sasp/FFT_versus_Direct_Convolution.html)
8. [Discovering Transforms: A Tutorial on Circulant Matrices, Circular Convolution, and the Discrete Fourier Transform (arXiv:1805.05533)](https://ar5iv.labs.arxiv.org/html/1805.05533)
9. [DFT and FFT: An Algebraic View (CMU SPIRAL)](https://spiral.ece.cmu.edu/pub-smart/pubfile/aspfft_38.pdf)
10. [Lecture 10: Circular convolution (MIT RES.6-008 Digital Signal Processing, Prof. Alan V. Oppenheim)](https://ocw.mit.edu/courses/res-6-008-digital-signal-processing-spring-2011/610905d8154ec2bfc090cf78022249a5_MITRES_6_008S11_lec10.pdf)
11. [Lecture 24: Circular Convolution (ECE 401, UIUC)](https://courses.grainger.illinois.edu/ece401/fa2024/slides/lec24.pdf)
12. [The Discrete Fourier Transform (course notes, University of Florida)](https://www.cise.ufl.edu/~ritter/cap4410/Resources/dft.pdf)
13. [James W. Cooley, John W. Tukey (1965). An algorithm for the machine calculation of complex Fourier series. Mathematics of Computation.](https://doi.org/10.1090/s0025-5718-1965-0178586-1)
14. [Math & Engineering: Discrete Convolutions (2023-09-19)](https://xn--2-umb.com/23/convolution/)
15. [H.K. Garg (1996). Skew circular convolution algorithms over finiteinteger rings. Electronics Letters.](https://doi.org/10.1049/el:19961503)
16. [CAT: Circular-Convolutional Attention for Sub-Quadratic Transformers (NeurIPS 2025)](https://papers.nips.cc/paper_files/paper/2025/file/d9f8b5abc8e0926539ecbb492af7b2f1-Paper-Conference.pdf)
17. [MRConv: Reparameterized Multi-Resolution Convolutions for Long Sequence Modelling (NeurIPS 2024)](https://proceedings.neurips.cc/paper_files/paper/2024/file/2f9ee101e35b890d9eae79ee27bcd69a-Paper-Conference.pdf)
18. [Simple Hardware-Efficient Long Convolutions for Sequence Modeling (FlashButterfly)](https://arxiv.org/pdf/2302.06646v1.pdf)
19. [FlashFFTConv: Efficient Convolutions for Long Sequences with Tensor Cores (ICLR 2024)](https://proceedings.iclr.cc/paper_files/paper/2024/file/281190d87732639e63bc19dedd7d711b-Paper-Conference.pdf)
20. [Implicitly Dealiased Convolutions (Roberts & Bowman)](https://malcolmroberts.github.io/publications/roberts_bowman_cse1015.pdf)
21. [Hybrid Dealiasing of Complex Convolutions](http://www.math.ualberta.ca/~bowman/publications/hybrid.pdf)
22. [The conv function and implementation tradeoffs (MATLAB / Steve Eddins)](https://blogs.mathworks.com/steve/2009/11/03/the-conv-function-and-implementation-tradeoffs/)
23. [Fast Digital Convolutions using Bit-Shifts](https://ar5iv.labs.arxiv.org/html/1005.1497)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数学分析与数学模型 › Harmonic analysis, transforms, and integral equations

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/circular-convolution

English original: https://www.edgepedia.org/circular-convolution
