summaryrefslogtreecommitdiff
path: root/src/CHAD/Types
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-04-29 15:54:12 +0200
committerTom Smeding <tom@tomsmeding.com>2025-04-29 15:54:12 +0200
commit3fd8d35cca2a23c137934a170c67e8ce310edf13 (patch)
tree429fb99f9c1395272f1f9a94bfbc0e003fa39b21 /src/CHAD/Types
parent919a36f8eed21501357185a90e2b7a4d9eaf7f08 (diff)
Complete monoidal accumulator rewrite
Diffstat (limited to 'src/CHAD/Types')
-rw-r--r--src/CHAD/Types/ToTan.hs5
1 files changed, 5 insertions, 0 deletions
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"