Crate aude

Source
Expand description

§Aude

An automated differentiation solver with a Lisp-like functional programming language

=== Aude 0.2 ===
Type `help` for more information.
> mul

mul

ty: (fun (tup f64 f64) f64)

D: (lam (tup f64 f64) (tup mul($0) (lin_lam (tup f64 f64) add((tup mul((tup fst(f64)(f64)($0) fst(f64)(f64)($1))) mul((tup snd(f64)(f64)($0) snd(f64)(f64)($1))))))))

To run Aude from your Terminal, type:

cargo install --example aude aude

Then, to run:

aude

§References

The Simple Essence of Automatic Differentiation

§Design

Aude uses a Lisp-like syntax, to avoid pain during translating to and from other programming languages.

For example, instead of f64 -> f64, Aude uses (ty f64 f64).

Function application uses the syntax <function>(<argument>), e.g. sin(0).

Variables uses De Bruijn indices, e.g. $0 refers to the lambda argument.

All operators take 2 arguments, e.g. (fun f64 f64).

§Features

FunctionDescription
addAddition
cosCosine (trigonometry)
fstFirst tuple component
fst_parFirst parallel component
idIdentity
negNegation
mulMultiplication
sinSine (trigonometry)
sndSecond tuple component
snd_parSecond parallel component
OpDescriptionExample
compComposes functionsg . f = (comp g f)
lin_compComposes linear functionsg . f = (lin_comp g f)
funFunction typef64 -> f64 = (fun f64 f64)
linLinear function typef64 -o f64 = (lin f64 f64)
lamLambda expression\x:f64.x = (lam f64 $0)
lam_linLinear lambda expression\x:f64.x = (lin_lam f64 $0)
parParallel tuplef x g = (par f g)
tupTuple(f, g) = (tup f g)
tyTypex : f64 = (ty x f64)

Modules§

parsing
Parsing.

Structs§

F64Val
Used to wrap f64 for Expr.

Enums§

Expr
Represents an expression.
Function
Stores a function.
Meta
Stores meta data.
Op
Stores operator.
Type
Store a types.

Functions§

add
add
app
Function application.
comp
comp
cos
cos
fst
fst
fst_par
fst_par
fun
fun
lam
Construct lambda expression from type and body expression.
lam_lin
lam_lin
lin
lin
lin_comp
lin_comp
mul
mul
neg
neg
par
par
par_lin
par_lin
sin
sin
snd
snd
snd_par
snd_par
tup
tup
ty
ty