← Back to Blog
How-To

How to Accelerate Existing Quant Libraries with AADC

A practical guide to integrating AADC into existing quantitative libraries — using ORE as the reference example, showing the black-box recording pattern that works on any C++ pricing library.

Dmitri Goloubentsev
Dmitri Goloubentsev
· 1 min read
AADC ORE integration guide quant libraries C++ black-box recording

Most banks and asset managers run quantitative models built on existing libraries: QuantLib, ORE, in-house C++ frameworks, or vendor platforms. Rewriting these libraries for performance is impractical: they contain years of accumulated business logic, regulatory compliance, and edge-case handling. The question is how to accelerate them without rewriting.

The Black-Box Pattern

AADC’s integration pattern treats the existing library as a black box. You do not need to understand, modify, or even have access to the library’s internal source code. The pattern has three steps:

  1. Hook inputs: Replace market data entry points (yield curves, FX spots, volatility surfaces) with AADC’s active type (idouble in C++, aadc.idouble in Python)
  2. Hook outputs: Capture the pricing results (NPV, cashflows) as active outputs
  3. Record and compile: Run the library’s pricing path once. AADC records every mathematical operation performed internally, compiles the graph, and produces a native kernel

ORE as Reference Example

Open Risk Engine (ORE) is an ideal reference because it is open-source, widely used, and built on QuantLib’s complex C++ architecture. The integration requires changes only at the boundary, where market data enters and where NPV exits. ORE’s internal curve construction, interpolation, and instrument pricing are recorded automatically.

The compiled kernel reproduces ORE’s exact numerical results at native machine code speed. All of ORE’s carefully validated pricing logic is preserved; only the execution mechanism changes.

Applicable to Any Library

The same pattern works on any library that performs double-precision arithmetic: in-house C++ pricing engines, vendor libraries (with source access), legacy Fortran code (via C wrappers), and Python/NumPy models. If the library uses standard floating-point operations, AADC can record and compile it.


Published by MatLogica. Implemented using AADC, a commercial adjoint AD compiler (matlogica.com).

Want to see these results on your own portfolio?

Get in Touch

Interested in these opportunities?

Let's arrange a free demo for you and your team.

Book a Demo