diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-02-28 16:11:14 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-02-28 16:11:14 +0100 |
commit | e40e33bc16175b6a0180e3ef88d0a588819e6c37 (patch) | |
tree | fff0a39039edc117d86a5da1cd793bb633cc91c9 /src/Array.hs | |
parent | e9ab5d50093e48b64d758d67388ef32321ad1984 (diff) |
Compile to C and load using dlopen
Diffstat (limited to 'src/Array.hs')
-rw-r--r-- | src/Array.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Array.hs b/src/Array.hs index ef9bb8d..82c3f31 100644 --- a/src/Array.hs +++ b/src/Array.hs @@ -41,6 +41,10 @@ shapeSize :: Shape n -> Int shapeSize ShNil = 1 shapeSize (ShCons sh n) = shapeSize sh * n +shapeRank :: Shape n -> SNat n +shapeRank ShNil = SZ +shapeRank (sh `ShCons` _) = SS (shapeRank sh) + fromLinearIndex :: Shape n -> Int -> Index n fromLinearIndex ShNil 0 = IxNil fromLinearIndex ShNil _ = error "Index out of range" |