Skip to content

Modern Expression Template assisted Automatic differentiation Library

License

Notifications You must be signed in to change notification settings

gabor-varga/metal

Repository files navigation

METAL

Modern Expression Template assisted Automatic differentiation Library

Introduction

This header-only C++ library is developed to simplify partial derivative computation by implementing efficient automatic differentiation (AD).

It realies heavily on the expression template design pattern (ET) to optimise away temporaries by interfacing with a linear algebra library (Eigen) that supports this approach. During local ET evaluation backward AD, while globally forward AD is used. This enables complex computations to be performed (e.g. numerical integration of differential equations) without running into issues with stack size (of the backward algorithm).

Apart from using Eigen, it is also designed to be used together with it allow vectorizing computations.

Examples

metal::Scalar a{ 1.0, "a" };
metal::Scalar b{ 2.0, "b" };
metal::Scalar c{ 3.0, "c" };
metal::Scalar x = sin( a ) * 0.5 + b * c;

Testing

Catch2 is integrated for testing. A single-header version is included in the repository test folder.

Compilation

This is a header-only library. To compile the tests and examples a c++11 compatible compiler is required. A ninja build script is provided for user convenience. To build, simply use:

ninja

Dependencies

This project relies heavily on Eigen. Minimal version of 3.3.x is reccomended (probably works with any Eigen3 version).

Disclaimer

This project a work in progress.

About

Modern Expression Template assisted Automatic differentiation Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages