summaryrefslogtreecommitdiff
path: root/src/CHAD.hs
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2025-04-21 21:56:34 +0200
committerTom Smeding <t.j.smeding@uu.nl>2025-04-21 21:56:34 +0200
commitc586e7d2343fa735a9b27e0b1a201dd2cb2bc68e (patch)
tree9315228980b2c5983c785889b815aaab46534052 /src/CHAD.hs
parent0dc5c31b023ee7d569bbc0df7615b2bf55ba01f5 (diff)
Add integer modulo operator
Diffstat (limited to 'src/CHAD.hs')
-rw-r--r--src/CHAD.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/CHAD.hs b/src/CHAD.hs
index 6ab4cfb..1126fde 100644
--- a/src/CHAD.hs
+++ b/src/CHAD.hs
@@ -219,6 +219,7 @@ d1op (ORecip t) e = EOp ext (ORecip t) e
d1op (OExp t) e = EOp ext (OExp t) e
d1op (OLog t) e = EOp ext (OLog t) e
d1op (OIDiv t) e = EOp ext (OIDiv t) e
+d1op (OMod t) e = EOp ext (OMod t) e
-- | Both primal and dual must be duplicable expressions
data D2Op a t = Linear (forall env. Ex env (D2 t) -> Ex env (D2 a))
@@ -244,6 +245,7 @@ d2op op = case op of
OExp t -> floatingD2 t $ Nonlinear $ \e d -> EOp ext (OMul t) (EPair ext (EOp ext (OExp t) e) d)
OLog t -> floatingD2 t $ Nonlinear $ \e d -> EOp ext (OMul t) (EPair ext (EOp ext (ORecip t) e) d)
OIDiv t -> integralD2 t $ Linear $ \_ -> ENothing ext (STPair STNil STNil)
+ OMod t -> integralD2 t $ Linear $ \_ -> ENothing ext (STPair STNil STNil)
where
d2opUnArrangeInt :: SScalTy a
-> (D2s a ~ TScal a => D2Op (TScal a) t)