diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-11-08 20:29:29 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-11-08 20:29:29 +0100 |
commit | 4fcdb7118e0084f192753ea6c70394352a27d5ed (patch) | |
tree | c5e91ae438b6f4c3e5075bf591e5fbe28aa5d96b /src/Simplify.hs | |
parent | 83692cf41f76272423445c9cbbad65561ee3b50c (diff) |
Custom derivatives
Diffstat (limited to 'src/Simplify.hs')
-rw-r--r-- | src/Simplify.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs index d3ee03c..e32ba8c 100644 --- a/src/Simplify.hs +++ b/src/Simplify.hs @@ -121,11 +121,12 @@ simplify' = \case EIdx _ a b -> EIdx ext <$> simplify' a <*> simplify' b EShape _ e -> EShape ext <$> simplify' e EOp _ op e -> EOp ext op <$> simplify' e - ECustom _ s t a b c e1 e2 -> - ECustom ext s t <$> (let ?accumInScope = False in simplify' a) - <*> (let ?accumInScope = False in simplify' b) - <*> (let ?accumInScope = False in simplify' c) - <*> simplify' e1 <*> simplify' e2 + ECustom _ s t p a b c e1 e2 -> + ECustom ext s t p + <$> (let ?accumInScope = False in simplify' a) + <*> (let ?accumInScope = False in simplify' b) + <*> (let ?accumInScope = False in simplify' c) + <*> simplify' e1 <*> simplify' e2 EWith e1 e2 -> EWith <$> simplify' e1 <*> (let ?accumInScope = True in simplify' e2) EAccum i e1 e2 e3 -> EAccum i <$> simplify' e1 <*> simplify' e2 <*> simplify' e3 EZero t -> pure $ EZero t @@ -165,7 +166,7 @@ hasAdds = \case ESum1Inner _ e -> hasAdds e EUnit _ e -> hasAdds e EReplicate1Inner _ a b -> hasAdds a || hasAdds b - ECustom _ _ _ a b c d e -> hasAdds a || hasAdds b || hasAdds c || hasAdds d || hasAdds e + ECustom _ _ _ _ a b c d e -> hasAdds a || hasAdds b || hasAdds c || hasAdds d || hasAdds e EConst _ _ _ -> False EIdx0 _ e -> hasAdds e EIdx1 _ a b -> hasAdds a || hasAdds b |