Algorithmic differentiation for domain specific languages in C++ with expression templates

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sagebaum, Max, Gauger, Nicolas R.
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918342985515008
author Sagebaum, Max
Gauger, Nicolas R.
author_facet Sagebaum, Max
Gauger, Nicolas R.
contents The application of operator overloading algorithmic differentiation (AD) to computer programs in order to compute the derivative is quite common. But, the replacement of the underlying computational floating point type with the specialized type of an AD tool has two problems. First, the memory structure of the program is changed and floating-point data is interleaved with identifiers from AD. This prevents the compiler from performing optimizations such as SIMD optimizations. Second, the AD tool does not see any domain-specific operations, e.,g. linear algebra operations, that the program uses. This prevents the AD tool from using specialized algorithms in such places. We propose a new AD tool that is tailored to such situations. The memory structure of the primal data is retained by associating an identifier with each entity, e.,g. matrix, and not with each floating point value, e.,g. element of the matrix. Operations on such entities can then be annotated and a generator is used to create the AD overloads. We demonstrate that this approach provides performance comparable to that of other specializations. In addition, the run-time factor is below the theoretical 4.5 of reverse AD for programs that are written purely with linear algebra entities and operations.
format Preprint
id arxiv_https___arxiv_org_abs_2602_15613
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Algorithmic differentiation for domain specific languages in C++ with expression templates
Sagebaum, Max
Gauger, Nicolas R.
Mathematical Software
68N30
G.1.4; G.4; D.2.2
The application of operator overloading algorithmic differentiation (AD) to computer programs in order to compute the derivative is quite common. But, the replacement of the underlying computational floating point type with the specialized type of an AD tool has two problems. First, the memory structure of the program is changed and floating-point data is interleaved with identifiers from AD. This prevents the compiler from performing optimizations such as SIMD optimizations. Second, the AD tool does not see any domain-specific operations, e.,g. linear algebra operations, that the program uses. This prevents the AD tool from using specialized algorithms in such places. We propose a new AD tool that is tailored to such situations. The memory structure of the primal data is retained by associating an identifier with each entity, e.,g. matrix, and not with each floating point value, e.,g. element of the matrix. Operations on such entities can then be annotated and a generator is used to create the AD overloads. We demonstrate that this approach provides performance comparable to that of other specializations. In addition, the run-time factor is below the theoretical 4.5 of reverse AD for programs that are written purely with linear algebra entities and operations.
title Algorithmic differentiation for domain specific languages in C++ with expression templates
topic Mathematical Software
68N30
G.1.4; G.4; D.2.2
url https://arxiv.org/abs/2602.15613