diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-14 10:08:03 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-14 10:08:03 +0200 |
commit | 22f8f053f9ea2a3273d25f49ecd88a30ad506972 (patch) | |
tree | da1b7879fbb87479874490d5a2d2680a7979f593 /src/Data/Array/Nested/Internal/Ranked.hs | |
parent | c6b912051ddac25c9d7efe2f8162eac9068a335c (diff) |
Export full [mrs]{shape,rank,size} set
Diffstat (limited to 'src/Data/Array/Nested/Internal/Ranked.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Ranked.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs index 6a4db8e..306acc0 100644 --- a/src/Data/Array/Nested/Internal/Ranked.hs +++ b/src/Data/Array/Nested/Internal/Ranked.hs @@ -223,12 +223,16 @@ instance (FloatElt a, NumElt a, PrimElt a, Num a) => Floating (Ranked n a) where log1mexp = arithPromoteRanked GHC.Float.log1mexp -rshape :: forall n a. Elt a => Ranked n a -> IShR n +rshape :: Elt a => Ranked n a -> IShR n rshape (Ranked arr) = shCvtXR' (mshape arr) rrank :: Elt a => Ranked n a -> SNat n rrank = shrRank . rshape +-- | The total number of elements in the array. +rsize :: Elt a => Ranked n a -> Int +rsize = shrSize . rshape + rindex :: Elt a => Ranked n a -> IIxR n -> a rindex (Ranked arr) idx = mindex arr (ixCvtRX idx) |