Compile-Time Symbolic Differentiation Using C++ Expression Templates
Drosos Kourounis, Leonidas Gergidis, Michael Saunders, Andrea Walther, and Olaf Schenk

TL;DR
This paper presents a method using C++ expression templates to perform compile-time symbolic differentiation of algebraic functions, generating derivative code efficiently during compilation.
Contribution
It introduces a novel approach for compile-time symbolic differentiation in C++ using expression templates and recursive simplification techniques.
Findings
Current C++ compilers are capable of supporting practical implementation.
The method efficiently generates derivatives at compile time.
Further compiler improvements could enhance performance and capabilities.
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 and an algebraic function of multiple variables, the compiler generates executable code for the th 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.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNumerical Methods and Algorithms · Logic, programming, and type systems · Formal Methods in Verification
