summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-10-22 22:02:06 +0200
committerTom Smeding <tom@tomsmeding.com>2024-10-22 22:02:06 +0200
commit79e072eddf0ec2a97ca455c27cb5ff6f2132bbab (patch)
tree2099dc7e9d9a1109d844bca73277ca82983a02c2 /test
parente7d7ac0fd8b81c1d6fae9ab7c1e4654133c631ea (diff)
Differentiate Replicate
Diffstat (limited to 'test')
-rw-r--r--test/Main.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Main.hs b/test/Main.hs
index d90d9cd..f779352 100644
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -229,8 +229,18 @@ tests :: IO Bool
tests = checkParallel $ Group "AD"
[("id", adTest $ fromNamed $ lambda #x $ body $ #x)
+ ,("idx0", adTest $ fromNamed $ lambda #x $ body $ idx0 #x)
+
,("sum-vec", adTest $ fromNamed $ lambda #x $ body $ idx0 (sum1i #x))
+ ,("sum-replicate", adTest $ fromNamed $ lambda #x $ body $
+ idx0 $ sum1i $ replicate1i 10 #x)
+
+ ,("pairs", adTest $ fromNamed $ lambda #x $ lambda #y $ body $
+ let_ #p (pair #x #y) $
+ let_ #q (pair (snd_ #p * fst_ #p + #y) #x) $
+ fst_ #q * #x + snd_ #q * fst_ #p)
+
,("build0", adTest $ fromNamed $ lambda @(TArr N0 _) #x $ body $
idx0 $
build SZ (shape #x) $ #idx :-> #x ! #idx)