From 3fd8d35cca2a23c137934a170c67e8ce310edf13 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 29 Apr 2025 15:54:12 +0200 Subject: Complete monoidal accumulator rewrite --- src/CHAD/Types/ToTan.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/CHAD') diff --git a/src/CHAD/Types/ToTan.hs b/src/CHAD/Types/ToTan.hs index f843206..87c01cb 100644 --- a/src/CHAD/Types/ToTan.hs +++ b/src/CHAD/Types/ToTan.hs @@ -40,3 +40,8 @@ toTan typ primal der = case typ of STScal sty -> case sty of STI32 -> der ; STI64 -> der ; STF32 -> der ; STF64 -> der ; STBool -> der STAccum{} -> error "Accumulators not allowed in input program" + STLEither t1 t2 -> case (primal, der) of + (_, Nothing) -> Nothing + (Just (Left p), Just (Left d)) -> Just (Left (toTan t1 p d)) + (Just (Right p), Just (Right d)) -> Just (Right (toTan t2 p d)) + _ -> error "Primal and cotangent disagree on LEither alternative" -- cgit v1.2.3-70-g09d2