summaryrefslogtreecommitdiff
path: root/src/Array.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-10-01 23:18:15 +0200
committerTom Smeding <tom@tomsmeding.com>2024-10-01 23:18:15 +0200
commit948cae3ca7279040627db393e4372a668f8a22f7 (patch)
tree89eae02aeba1f0bdc30a938c82dc3dfef06cd4af /src/Array.hs
parent1f13bc80915a26473e0622c4afa65c8276b396ff (diff)
Reverse-by-forward, and checking neural (it's wrong)
Diffstat (limited to 'src/Array.hs')
-rw-r--r--src/Array.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Array.hs b/src/Array.hs
index c939419..8507544 100644
--- a/src/Array.hs
+++ b/src/Array.hs
@@ -45,6 +45,9 @@ emptyShape :: SNat n -> Shape n
emptyShape SZ = ShNil
emptyShape (SS m) = emptyShape m `ShCons` 0
+enumShape :: Shape n -> [Index n]
+enumShape sh = map (fromLinearIndex sh) [0 .. shapeSize sh - 1]
+
-- | TODO: this Vector is a boxed vector, which is horrendously inefficient.
data Array (n :: Nat) t = Array (Shape n) (Vector t)