Crate aegir

Crate aegir 

Source
Expand description

Strongly-typed, compile-time autodifferentiation in Rust.

aegir is an experimental autodifferentiation framework designed to leverage the powerful type-system in Rust and avoid runtime as much as humanly possible. The approach taken resembles that of expression templates, as commonly used in linear-algebra libraries written in C++, and indeed mirrors (in many ways) the concept of Iterator in std.

A key distinction of aegir from existing autodiff frameworks is that it does not rely on a monolithic Tensor type that handles shape transformations at runtime. This would be equivalent to using the ndarray crate to handle all numerical computations and data-storage/layouts. While this has its advantages - like simplicity and ease of use - our approach is a strict generalisation and allows for much greater flexibility. By incorporating both dynamic and fixed-size data structures, we also have the advantage of the various compile-time optimisations that come from using arrays, tuples, and scalars.

§Key Features

  • Built-in arithmetic, linear-algebraic, trigonometric and special operators.
  • Infinitely differentiable: Jacobian, Hessian, etc…
  • Decoupled/generic tensor type.
  • Monadic runtime optimisation.
  • Custom DSL for operator expansion.

Modules§

buffers
Module for tensor abstractions and their implementations.
errors
Module for helper error types.
fmt
Module containing formatting logic.
ids
Quality-of-life shortcuts for commonly-used identifiers.
meta
Module containing meta operators.
ops
Module for concrete operator implementations.

Macros§

ctx
Helper macro for creating anonymous Context types.
ctx_type
Helper macro for defining simple, auto-magical Context types.
dual
Helper macro to construct a Dual variable.

Structs§

Dual
Dual variable for forward-mode autodifferentiation over aegir buffers.

Traits§

Contains
Trait for operator Nodes that can assert their symbolic contents.
Context
Trait for types that store data buffers.
Differentiable
Trait for operator Nodes with a well-defined adjoint.
Function
Trait for operator Nodes that can be evaluated against a Context.
Identifier
Interface for type-level identifiers.
Node
Base trait for operator nodes.
Read
Trait for reading entries out of a Context.

Type Aliases§

AdjointOf
Alias for the adjoint of a function.
AegirResult
Alias for the result type associated with a function.
DualOf
Alias for the dual associated with a function.
ErrorOf
Alias for the error type associated with a function.
ValueOf
Alias for the value type associated with a function.