From b1664532eaebdf0409ab6d93fc0ba2ef8dfbf372 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 27 Apr 2025 23:34:59 +0200 Subject: WIP revamp accumulators again: explicit monoid types No more D2 in accumulators! Paving the way for configurable sparsity of products and arrays. The idea is to make separate monoid types for a "product cotangent" and an "array cotangent" that can be lowered to either a sparse monoid or a non-sparse monoid. Downsides of this approach: lots of API duplication. --- src/CHAD/Accum.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/CHAD/Accum.hs') diff --git a/src/CHAD/Accum.hs b/src/CHAD/Accum.hs index b61b5ff..d8a71b5 100644 --- a/src/CHAD/Accum.hs +++ b/src/CHAD/Accum.hs @@ -10,9 +10,9 @@ import Data makeAccumulators :: SList STy envPro -> Ex (Append (D2AcE envPro) env) t -> Ex env (InvTup t (D2E envPro)) makeAccumulators SNil e = e -makeAccumulators (t `SCons` envpro) e = +makeAccumulators (t `SCons` envpro) e | Refl <- lemZeroInfoD2 t = makeAccumulators envpro $ - EWith ext t (EZero ext t) e + EWith ext (d2M t) (EZero ext (d2M t) (ENil ext)) e uninvertTup :: SList STy list -> STy core -> Ex env (InvTup core list) -> Ex env (TPair core (Tup list)) uninvertTup SNil _ e = EPair ext e (ENil ext) -- cgit v1.2.3-70-g09d2