From 20f7d7be13cd7869b338f98d1ab3fd33e8bbfb3e Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 27 Nov 2025 21:30:17 +0100 Subject: WIP user-specified custom types The big roadblock encountered is that accumulation wants addition of monoids to be elementwise float addition; this fundamentally clashes with the concept of a user type with a custom zero and plus. --- src/CHAD/ForwardAD/DualNumbers.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/CHAD/ForwardAD/DualNumbers.hs') diff --git a/src/CHAD/ForwardAD/DualNumbers.hs b/src/CHAD/ForwardAD/DualNumbers.hs index 540ec2b..4a07a2d 100644 --- a/src/CHAD/ForwardAD/DualNumbers.hs +++ b/src/CHAD/ForwardAD/DualNumbers.hs @@ -200,10 +200,14 @@ dfwdDN = \case EFold1InnerD1{} -> err_targetlang "EFold1InnerD1" EFold1InnerD2{} -> err_targetlang "EFold1InnerD2" + + EUser{} -> err_user "EUser" + EUnUser{} -> err_user "EUnUser" where err_accum = error "Accumulator operations unsupported in the source program" err_monoid = error "Monoid operations unsupported in the source program" err_targetlang s = error $ "Target language operation " ++ s ++ " not supported in source program" + err_user s = error $ "User types not yet supported in forward AD (" ++ s ++ ")" deriv_extremum :: ScalIsNumeric t ~ True => (forall env'. Ex env' (TArr (S n) (TScal t)) -> Ex env' (TArr n (TScal t))) -- cgit v1.2.3-70-g09d2