Skip to content

Commit

Permalink
Add "zero diff" constructor for tangent bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
bmsherman committed Jan 28, 2020
1 parent faeab0a commit fc17fb2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/FwdPSh.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ instance (PShD f) => PShD (Tan f) where
tangentValue :: Additive g => PShD f => Tan f g -> f g
tangentValue (Tan xdx f) = dmap (fstD @. xdx) f

tangentZero :: Additive g => f g -> Tan f g
tangentZero f = Tan (pairD dId zeroD) f

-- Both tangent bundles should be based on the same point
-- tangentAdd :: Additive g => Tan f g -> Tan f g -> Tan f g

tanR :: Tan DReal g :== (DReal :* DReal) g
tanR = Bijection from to where
from (Tan gdd (R fd)) = R (fstD @. x) :* R (sndD @. x) where
Expand Down Expand Up @@ -325,6 +331,8 @@ newton_cut :: R.Rounded a => Additive g => ((g, Interval a) :~> Interval a -> (g
-> g :~> (Interval a)
newton_cut f = newton_cut' (f sndD)

-- Need to fix this to account for the special cases where
-- the argmax might be 0 or 1.
argmax01' :: Additive g => R.Rounded a =>
((g, Interval a) :~> Interval a) -> (g :~> Interval a)
argmax01' f = let fwd2f = fwdSecondDer f in
Expand Down

0 comments on commit fc17fb2

Please sign in to comment.