As computational challenges in optimization and statistical inference grow ever harder, algorithms that utilize derivatives are becoming increasingly more important. The implementation of the derivatives that make these algorithms so powerful, however, is a substantial user burden and the practicality of these algorithms depends critically on tools like automatic differentiation that remove the implementation burden entirely. The Stan Math Library is a C++, reverse-mode automatic differentiation library designed to be usable, extensive and extensible, efficient, scalable, stable, portable, and redistributable in order to facilitate the construction and utilization of such algorithms. Usability is achieved through a simple direct interface and a cleanly abstracted functional interface. The extensive built-in library includes functions for matrix operations, linear algebra, differential equation solving, and most common probability functions. Extensibility derives from a straightforward object-oriented framework for expressions, allowing users to easily create custom functions. Efficiency is achieved through a combination of custom memory management, subexpression caching, traits-based metaprogramming, and expression templates. Partial derivatives for compound functions are evaluated lazily for improved scalability. Stability is achieved by taking care with arithmetic precision in algebraic expressions and providing stable, compound functions where possible. For portability, the library is standards-compliant C++ (03) and has been tested for all major compilers for Windows, Mac OS X, and Linux.
翻译:随着优化和统计推断的计算挑战日益严峻,使用衍生物的算法变得越来越重要。但实施使这些算法如此强大的衍生物是一个巨大的用户负担,这些算法的实用性主要取决于自动区分等工具,完全消除执行负担。斯坦数学图书馆是一个C++,反向模式自动区分图书馆,设计的目的是便于使用、广泛和扩展、高效、可缩放、稳定、可移植和可再分配,以便利这些算法的构建和使用。通过简单的直接界面和干净的抽象功能界面,实现了可使用性。庞大的内建图书馆包括矩阵操作功能、线性代数、差异方程式解析和最常见的概率功能。强化性来自一个直截了当的面向目标的表达式框架,使用户能够容易创建定制功能。效率是通过定制记忆管理、亚表层缩放、基于特性的元谱化和表达式模板来实现的。对复合功能的部分衍生物进行了评估,以便改进可缩放性。通过对精度进行精度测试,稳定性化的C+VLS的版本,从而实现了所有精确度的版本。