From 22f8f053f9ea2a3273d25f49ecd88a30ad506972 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 14 Jun 2024 10:08:03 +0200 Subject: Export full [mrs]{shape,rank,size} set --- src/Data/Array/Nested/Internal/Shaped.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Data/Array/Nested/Internal/Shaped.hs') diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index 5765595..9588017 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -225,6 +225,13 @@ instance (FloatElt a, NumElt a, PrimElt a, Num a) => Floating (Shaped sh a) wher sshape :: forall sh a. Elt a => Shaped sh a -> ShS sh sshape (Shaped arr) = shCvtXS' (mshape arr) +srank :: Elt a => Shaped sh a -> SNat (Rank sh) +srank = shsRank . sshape + +-- | The total number of elements in the array. +ssize :: Elt a => Shaped sh a -> Int +ssize = shsSize . sshape + sindex :: Elt a => Shaped sh a -> IIxS sh -> a sindex (Shaped arr) idx = mindex arr (ixCvtSX idx) -- cgit v1.2.3-70-g09d2