circuits-diff
Safe HaskellNone
LanguageGHC2024

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 Diff p Double Double gives reverse-mode derivatives of every intermediate.

Synopsis

Documentation

class Lit a where Source #

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 lit c once, and resolves correctly under both simulation and differentiation.

Methods

lit :: Double -> a Source #

Instances

Instances details
Lit Double Source # 
Instance details

Defined in Circuit.Diff.Carrier

Methods

lit :: Double -> Double Source #

Lit (Diff p Double Double) Source # 
Instance details

Defined in Circuit.Diff.Carrier