diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-10-22 22:02:06 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-10-22 22:02:06 +0200 |
commit | 79e072eddf0ec2a97ca455c27cb5ff6f2132bbab (patch) | |
tree | 2099dc7e9d9a1109d844bca73277ca82983a02c2 /test | |
parent | e7d7ac0fd8b81c1d6fae9ab7c1e4654133c631ea (diff) |
Differentiate Replicate
Diffstat (limited to 'test')
-rw-r--r-- | test/Main.hs | 10 |
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) |