# 仿射算术

**仿射算术**（Affine arithmetic，AA）是一种自验证数值计算模型。在该模型中，每个不确定量都由一个仿射形式表示——即关于符号噪声变量的一次多项式——从而在计算过程中追踪各量之间的线性相关性。与区间算术（interval arithmetic，IA）一样，它产生保证包含真值的包围区间，既考虑了输入数据中的不确定性，也考虑了内部截断与舍入误差；与区间算术不同的是，其误差通常是输入区间宽度的二次函数，而非线性函数。<sup>[1](https://tema.sbmac.org.br/tema/article/view/352)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 由 J. L. D. Comba 与 J. Stolfi 提出，发表于 SIBGRAPI'93（累西腓，1993年10月）；E. R. Hansen 于1975年提出了类似模型<sup>[1](https://tema.sbmac.org.br/tema/article/view/352)</sup><sup> • </sup><sup>[3](https://www.iri.upc.edu/people/thomas/Collection/details/45477.html)</sup>  |
| 表示方式 | 量 x 表示为仿射形式 \( \hat{x} = x_0 + \sum_{i=1}^{n} x_i \epsilon_i \)，其中噪声符号 \( \epsilon_i \in [-1, 1] \)<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup> |
| 包围范围 | \( [\hat{x}] = [x_0 - \mathrm{rad}(\hat{x}),\ x_0 + \mathrm{rad}(\hat{x})] \)，其中 \( \mathrm{rad}(\hat{x}) = \sum_{i=1}^{n} |x_i| \)<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup> |
| 精度 | 近似误差为输入区间宽度的二次函数，而区间算术的误差为线性<sup>[1](https://tema.sbmac.org.br/tema/article/view/352)</sup><sup> • </sup><sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup>  |
| 计算代价 | 线性运算逐项精确计算；非线性运算需要近似，并引入过近似<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup> |
| 已知缺陷 | 每次非线性运算都新增一个噪声符号，因此在长计算链中项数会不断增长<sup>[6](https://kam.mff.cuni.cz/~hladik/publ/b2hd-SkaHla2017a.html)</sup> |
| 软件 | 实现包括 Stolfi 的 C 语言库 libaa、C++ 库 aaflib，以及 INTLAB 的 affari 工具箱<sup>[7](https://aaflib.sourceforge.net/)</sup><sup> • </sup><sup>[8](https://www.jstage.jst.go.jp/article/nolta/6/3/6_341/_article/-char/en)</sup>  |

## 区间算术中的依赖问题

区间算术由 R. E. Moore 于20世纪60年代提出，它将每个量表示为一个保证包含其真值的区间，并用区间进行运算，使结果包围每次操作的所有可能值。<sup>[2](https://graphics.stanford.edu/~comba/papers/aa-93-12-petersburg-paper.pdf)</sup> 其主要缺陷是过度保守：产生的区间往往远宽于所计算量的真实范围，有时甚至宽到毫无用处，而在每级输出馈入下一级的长计算链中，这一问题尤为严重。<sup>[2](https://graphics.stanford.edu/~comba/papers/aa-93-12-petersburg-paper.pdf)</sup>

原因在于，标准区间运算总是假定未知参数值在其区间内独立变化。当数学约束将各量联系起来时，并非所有取值组合都是有效的，但区间结果必须覆盖所有这些组合。标准例子是用区间算术计算 \( x \cdot x \)：结果为 \( [x_{\mathrm{lo}} x_{\mathrm{hi}},\ x_{\mathrm{hi}} x_{\mathrm{lo}}] \)，宽度是原区间的两倍，而非真实范围 \( [0, 0] \)。减法例程无法分辨两个相同的区间表示的是同一个量，还是恰好共享同一范围的两个独立量。<sup>[2](https://graphics.stanford.edu/~comba/papers/aa-93-12-petersburg-paper.pdf)</sup> 这种行为被称为误差爆炸或依赖问题，它也是仿射算术所要减轻的包裹效应的根源。<sup>[8](https://www.jstage.jst.go.jp/article/nolta/6/3/6_341/_article/-char/en)</sup>

## 仿射形式

在仿射算术中，部分未知的量 x 由仿射形式表示，即噪声项的线性组合：

\[ \hat{x} = x_0 + x_1 \epsilon_1 + x_2 \epsilon_2 + \cdots + x_n \epsilon_n, \qquad \epsilon_i \in [-1, 1]. \]

其中 \( x_0 \) 为中心值，每个系数 \( x_i \) 为部分偏差，每个噪声符号 \( \epsilon_i \) 代表影响 x 的一个独立不确定性来源。<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup><sup> • </sup><sup>[9](https://www.mdpi.com/2227-7390/8/11/2092)</sup> 该形式蕴含区间界 \( x \in [x_0 - s,\ x_0 + s] \)，其中总偏差 \( s = \sum_{i=1}^{n} |x_i| \)。<sup>[9](https://www.mdpi.com/2227-7390/8/11/2092)</sup> 区间 \( [x_{\min}, x_{\max}] \) 可用单个噪声符号转换为等价的仿射形式 \( x_0 + x_1 \epsilon_1 \)，其中 \( x_0 \) 为中点，\( x_1 \) 为半宽。<sup>[10](https://link.springer.com/article/10.1186/1687-6180-2014-36)</sup>

这种表示的价值在于共享噪声符号。若两个仿射形式对同一 \( \epsilon_i \) 含有非零系数，则它们的变异性部分相同，运算时会识别出这一点。因此，对两个相关的范围作减法，得到的是缩小后的范围，而非区间算术固有的过近似；同时，可以在保持相同范围相关性的前提下模拟反馈回路。<sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup><sup> • </sup><sup>[11](https://onlinelibrary.wiley.com/doi/10.1155/2013/239064)</sup>

## 运算

**线性运算。** 加法、减法以及与常数相乘均逐项进行并精确计算：结果共享操作数的噪声符号，系数合并。<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup>

**非线性运算。** 将非仿射函数 f 作用于含 n 个噪声项的仿射形式，其结果一般无法仅用这 n 个项表示。因此，仿射算术在现有项上计算一个近似仿射形式 \( f^{a}(\hat{x}) \)，并新增一个误差项 \( x_k \epsilon_k \)，其系数为近似值与真实 f 之间的最大距离，从而保证结果包围 f 的范围。<sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup> 新符号 \( \epsilon_k \) 实际上是 \( \epsilon_1, \ldots, \epsilon_n \) 的函数，但后续运算将其视为独立，因此部分依赖信息丢失，依赖问题在某种程度上重新出现。若复合大量非线性运算，或近似质量较差，仿射算术相较区间算术的优势可能微乎其微。<sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup>

近似方式的选择至关重要。最重要的两种选择是切比雪夫（极小极大）近似和最小范围近似。<sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup> 切比雪夫近似使最大近似误差最小化，但其输出范围的包围可能比普通区间算术更差，某些情况下甚至对正值函数给出负的下界；这就是过冲问题。最小范围近似给出输出的最小范围，避免了过冲问题，且计算简便。<sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup>

**误差增长。** 由于每次非线性运算都引入新的噪声符号，项数随计算长度增长，这使得标准仿射算术在长计算链中效率低下。<sup>[6](https://kam.mff.cuni.cz/~hladik/publ/b2hd-SkaHla2017a.html)</sup> 实际系统通过固定最大符号数、合并噪声符号，或采用简化仿射算术（消除噪声符号的逐渐增加）和修正仿射算术（避免乘法过程中引入新噪声）等变体来处理这一问题。<sup>[6](https://kam.mff.cuni.cz/~hladik/publ/b2hd-SkaHla2017a.html)</sup><sup> • </sup><sup>[12](https://malyzajko.github.io/papers/oopsla2011.pdf)</sup><sup> • </sup><sup>[13](https://www.juestc.uestc.edu.cn/en/article/doi/10.3969/j.issn.1001-0548.2011.03.033)</sup>

## 与区间算术的精度比较

仿射近似的误差是输入区间大小的二次函数，因为对输入噪声非线性的项被合并入误差项，而当区间缩小时二次项占主导；区间算术的误差则是线性的。因此，仿射算术在输入区间较小时具有优势，而对于大区间，存在一个临界点，超过该点后额外的计算时间将超过其收益。<sup>[1](https://tema.sbmac.org.br/tema/article/view/352)</sup><sup> • </sup><sup>[5](https://link.springer.com/article/10.1007/s00180-017-0729-z)</sup> 实践中，仿射算术能产生更紧的范围，但并非普遍如此；当各噪声项较小时（例如追踪舍入误差时），其优势通常最为显著。<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup>

实现中可以将两种模型结合。INTLAB 的 affari 工具箱仅用仿射范围与普通区间算术所得范围的交集来继续计算，因此结果永远不会比单独使用区间算术更差。<sup>[14](https://www.tuhh.de/ti3/rump/intlab/demos/html/dintlab.html)</sup>

## 应用

**计算机图形学。** 仿射算术最初的动机来自具有深计算链的图形学问题，如光线追踪和曲面求交，这些问题中区间过估计最为严重。已发表的用途包括：对隐式和参数曲面进行光线投射、曲面求交，以及用条带树近似参数曲线——其中曲线片段的包围矩形由仿射算术提供的线性相关信息计算得出。<sup>[2](https://graphics.stanford.edu/~comba/papers/aa-93-12-petersburg-paper.pdf)</sup><sup> • </sup><sup>[15](https://onlinelibrary.wiley.com/doi/10.1111/1467-8659.00658)</sup>

**有限元分析。** 当手头数据稀少时，基于区间的不确定性模型适合结构安全工程，但依赖问题阻碍了实际应用。Degrauwe、Lombaert 和 De Roeck 提出了一种求解仿射线性方程组的方法，使仿射算术得以应用于有限元分析，并得到比区间分析更精确的结果。<sup>[16](https://www.sciencedirect.com/science/article/pii/S0045794909002764)</sup>

**电路与系统验证。** 仿射算术已被用作类 SPICE 非线性电路仿真器的主要计算库（通过 aaflib C++ 库），用于最坏情况电路容差分析，以及混合信号与控制系统的验证——其中参数不确定性、建立时间和稳定裕度指标被建模为仿射形式，并在仿真过程中进行检查。<sup>[7](https://aaflib.sourceforge.net/)</sup><sup> • </sup><sup>[1](https://tema.sbmac.org.br/tema/article/view/352)</sup><sup> • </sup><sup>[11](https://onlinelibrary.wiley.com/doi/10.1155/2013/239064)</sup>

**舍入与精度分析。** 静态分析工具利用仿射算术将范围约束得足够紧，以估计浮点和定点舍入误差：用于数值程序分析与优化的 Daisy 框架支持区间算术和仿射算术；Gappa++ 以基于仿射算术的引擎扩展了 Gappa 证明助手，能更精确地界定具有相关误差的线性计算。<sup>[4](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)</sup><sup> • </sup><sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC5552069/)</sup>

**软件实现。** 除最初的 libaa 和 aaflib 外，Matlab/Octave 工具箱 INTLAB 包含一个仿射算术工具箱，涵盖向量、矩阵、梯度、海森矩阵和泰勒展开，其实现细节与改进由汉堡工业大学可靠计算研究所所长 Siegfried M. Rump 和早稻田大学的 Masahide Kashiwagi 描述。<sup>[8](https://www.jstage.jst.go.jp/article/nolta/6/3/6_341/_article/-char/en)</sup><sup> • </sup><sup>[18](https://www.tuhh.de/ti3/intlab/)</sup> 一个 Julia 实现 AffineArithmetic.jl 基于 aaflib。<sup>[19](https://github.com/fireofearth/AffineArithmetic.jl/blob/master/README.md)</sup>

## References

1. [J. Stolfi and L. H. de Figueiredo (2003). An Introduction to Affine Arithmetic. Trends in Computational and Applied Mathematics.](https://tema.sbmac.org.br/tema/article/view/352)
2. [M. Andrade, J. L. D. Comba, and J. Stolfi (1993). Affine Arithmetic (draft, submitted to Interval'94).](https://graphics.stanford.edu/~comba/papers/aa-93-12-petersburg-paper.pdf)
3. [J. Stolfi and L. H. de Figueiredo (1997). Self-Validated Numerical Methods and Applications. 21st Brazilian Mathematics Colloquium, IMPA.](https://www.iri.upc.edu/people/thomas/Collection/details/45477.html)
4. [Daisy: Framework for Analysis and Optimization of Numerical Programs (Tool Paper). Springer.](https://link.springer.com/chapter/10.1007/978-3-319-89960-2_15)
5. [Efficient importance sampling in low dimensions using affine arithmetic. Computational Statistics, Springer.](https://link.springer.com/article/10.1007/s00180-017-0729-z)
6. [Milan Hladík: A new algorithm for Chebyshev minimum-error multiplication of reduced affine forms.](https://kam.mff.cuni.cz/~hladik/publ/b2hd-SkaHla2017a.html)
7. [aaflib - An Affine Arithmetic C++ Library. SourceForge.](https://aaflib.sourceforge.net/)
8. [S. M. Rump and M. Kashiwagi (2015). Implementation and improvements of affine arithmetic. NOLTA 6(3):341–359.](https://www.jstage.jst.go.jp/article/nolta/6/3/6_341/_article/-char/en)
9. [On the Normalization of Interval Data. Mathematics, MDPI 8(11):2092.](https://www.mdpi.com/2227-7390/8/11/2092)
10. [A refined affine approximation method of multiplication for range analysis in word-length optimization. EURASIP Journal on Advances in Signal Processing, Springer.](https://link.springer.com/article/10.1186/1687-6180-2014-36)
11. [C. Radojicic et al. (2013). Verification of Mixed-Signal Systems with Affine Arithmetic Assertions. VLSI Design, Wiley.](https://onlinelibrary.wiley.com/doi/10.1155/2013/239064)
12. [Fluctuat / noise symbol packing paper (OOPSLA 2011).](https://malyzajko.github.io/papers/oopsla2011.pdf)
13. [Xie Yong-qiang, Chen Jian-jun, Zhu Zeng-qing (2011). Uncertain System Response Bounds Analysis with Modified Affine Arithmetic. JUESTC 40(4):634–640.](https://www.juestc.uestc.edu.cn/en/article/doi/10.3969/j.issn.1001-0548.2011.03.033)
14. [DEMOINTLAB: A little demonstration of INTLAB. TU Hamburg.](https://www.tuhh.de/ti3/rump/intlab/demos/html/dintlab.html)
15. [L. H. de Figueiredo, J. Stolfi, L. Velho (2003). Approximating Parametric Curves With Strip Trees Using Affine Arithmetic. Computer Graphics Forum 22:171–179.](https://onlinelibrary.wiley.com/doi/10.1111/1467-8659.00658)
16. [D. Degrauwe, G. Lombaert, G. De Roeck (2010). Improving interval analysis in finite element calculations by means of affine arithmetic. Computers & Structures 88(3–4):247–254.](https://www.sciencedirect.com/science/article/pii/S0045794909002764)
17. [Towards Program Optimization through Automated Analysis of Numerical Precision (Gappa++). Proc. CGO / PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC5552069/)
18. [INTLAB - INTerval LABoratory. Institute for Reliable Computing, TU Hamburg.](https://www.tuhh.de/ti3/intlab/)
19. [AffineArithmetic.jl README. GitHub.](https://github.com/fireofearth/AffineArithmetic.jl/blob/master/README.md)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026; Oct 21, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Computational arithmetic › Affine and significance arithmetic

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/affine-arithmetic

English original: https://www.edgepedia.org/affine-arithmetic
