Skip to content

Commit

Permalink
Add derivatives.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Nov 22, 2023
1 parent b243944 commit 5ef4f90
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Futhark/AD/Derivatives.hs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,21 @@ pdBuiltin "lerp64" [v0, v1, t] =
untyped $ fMax64 0 (fMin64 1 (isF64 t)),
untyped $ isF64 v1 - isF64 v0
]
pdBuiltin "ldexp16" [x, y] =
Just
[ untyped $ 2 ** isF16 x,
untyped $ log 2 * (2 ** isF16 y) * isF16 x
]
pdBuiltin "ldexp32" [x, y] =
Just
[ untyped $ 2 ** isF32 x,
untyped $ log 2 * (2 ** isF32 y) * isF32 x
]
pdBuiltin "ldexp64" [x, y] =
Just
[ untyped $ 2 ** isF64 x,
untyped $ log 2 * (2 ** isF64 y) * isF64 x
]
pdBuiltin "erf16" [z] =
Just [untyped $ (2 / sqrt pi) * exp (negate (isF16 z * isF16 z))]
pdBuiltin "erf32" [z] =
Expand Down

0 comments on commit 5ef4f90

Please sign in to comment.