diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-04-27 23:34:59 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-04-27 23:34:59 +0200 |
commit | b1664532eaebdf0409ab6d93fc0ba2ef8dfbf372 (patch) | |
tree | a40c16fd082bbe4183e7b4194b8cea1408cec379 /src/CHAD/Accum.hs | |
parent | c750f8f9f1275d49ff74297e6648e1bfc1c6d918 (diff) |
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.
Diffstat (limited to 'src/CHAD/Accum.hs')
-rw-r--r-- | src/CHAD/Accum.hs | 4 |
1 files changed, 2 insertions, 2 deletions
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) |