| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Diff.Carrier
Description
Carrier injection for polymorphic differentiable models.
When a physical right-hand side is written once and polymorphic in a
numeric carrier, constants must be lifted into that carrier. Lit
provides the overload: instantiating at Double gives forward simulation;
instantiating at gives reverse-mode
derivatives of every intermediate.Diff p Double Double
Documentation
Lift a numeric literal into the active carrier.
instance Lit Double where lit = id instance Lit (Diff p Double Double) where lit c = Diff (const (c, const 0))
Every coefficient in a polymorphic model can be written once,
and resolves correctly under both simulation and differentiation.lit c