English

Compile-Time Symbolic Differentiation Using C++ Expression Templates

Symbolic Computation 2017-05-05 v1

Abstract

Template metaprogramming is a popular technique for implementing compile time mechanisms for numerical computing. We demonstrate how expression templates can be used for compile time symbolic differentiation of algebraic expressions in C++ computer programs. Given a positive integer NN and an algebraic function of multiple variables, the compiler generates executable code for the NNth partial derivatives of the function. Compile-time simplification of the derivative expressions is achieved using recursive templates. A detailed analysis indicates that current C++ compiler technology is already sufficient for practical use of our results, and highlights a number of issues where further improvements may be desirable.

Keywords

Cite

@article{arxiv.1705.01729,
  title  = {Compile-Time Symbolic Differentiation Using C++ Expression Templates},
  author = {Drosos Kourounis and Leonidas Gergidis and Michael Saunders and Andrea Walther and Olaf Schenk},
  journal= {arXiv preprint arXiv:1705.01729},
  year   = {2017}
}
R2 v1 2026-06-22T19:36:49.816Z