Compile time symbolic derivation with C++ templates

  • Authors:
  • Joseph Gil;Zvi Gutterman

  • Affiliations:
  • Technion and IBM T.J. Watson Research Center, Yorktown Heights, NY;Faculty of Computer Science, Technion Israel Institute of Technology, Haifa, Israel

  • Venue:
  • COOTS'98 Proceedings of the 4th conference on USENIX Conference on Object-Oriented Technologies and Systems - Volume 4
  • Year:
  • 1998

Quantified Score

Hi-index 0.00

Visualization

Abstract

C++ templates are already recognized as a powerful linguistic mechanism, whose usefulness transcends the realization of traditional generic containers. In the same venue, this paper reports on a somewhat surprising application of templates-for computing the symbolic derivative of expression. Specifically, we describe a software package based on templates, called SEMT, which allows the programmer to create symbolic expressions, substitute variables in them, and compute their derivatives. SEMT is unique in that these manipulations are all done at compile time. In other words, SEMT effectively coerces the compiler to do symbolic computation as part of the compilation process. Beyond the theoretical interest, SEMT can be practically applied in the efficient, generic and easy to use implementation of many numerical algorithms.