Optimising Code Generation with haggies
Thomas Reiter

TL;DR
Haggies is a versatile program that generates optimized code for numerical evaluation of mathematical expressions, using techniques like Horner-scheme and common subexpression elimination, applicable across various programming languages.
Contribution
The paper introduces haggies, a flexible tool for automatic code optimization and generation, adaptable to multiple languages and data types, with applications beyond physics.
Findings
Reduces operation count through optimization techniques.
Supports non-standard data types via type inference.
Successfully applied in quantum field theory calculations.
Abstract
This article describes haggies, a program for the generation of optimised programs for the efficient numerical evaluation of mathematical expressions. It uses a multivariate Horner-scheme and Common Subexpression Elimination to reduce the overall number of operations. The package can serve as a back-end for virtually any general purpose computer algebra program. Built-in type inference that allows to deal with non-standard data types in strongly typed languages and a very flexible, pattern-based output specification ensure that haggies can produce code for a large variety of programming languages. We currently use haggies as part of an automated package for the calculation of one-loop scattering amplitudes in quantum field theories. The examples in this articles, however, demonstrate that its use is not restricted to the field of high energy physics.
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.
