diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2024-11-21 13:49:25 +0100 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2024-11-21 13:49:52 +0100 |
commit | 7e5ccb3402f97c1c7cff158147aeb863d429f885 (patch) | |
tree | 8adaa90ef98d0316638eb6e128007aa86ac06d83 /src/Data/Array/Nested/Internal/Shaped.hs | |
parent | 1b69f540b0c1fa8d45b80f452cab8e7ac02dffd9 (diff) |
[rsm]emptyArray
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shaped.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index e2f65c0..228d800 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -163,11 +163,11 @@ instance Elt a => Elt (Shaped sh a) where vecs) instance (KnownShS sh, KnownElt a) => KnownElt (Shaped sh a) where - memptyArray :: forall sh'. IShX sh' -> Mixed sh' (Shaped sh a) - memptyArray i + memptyArrayUnsafe :: forall sh'. IShX sh' -> Mixed sh' (Shaped sh a) + memptyArrayUnsafe i | Dict <- lemKnownMapJust (Proxy @sh) = coerce @(Mixed sh' (Mixed (MapJust sh) a)) @(Mixed sh' (Shaped sh a)) $ - memptyArray i + memptyArrayUnsafe i mvecsUnsafeNew idx (Shaped arr) | Dict <- lemKnownMapJust (Proxy @sh) @@ -239,6 +239,9 @@ instance (FloatElt a, NumElt a, PrimElt a, Floating a, KnownShS sh) => Floating log1mexp = arithPromoteShaped GHC.Float.log1mexp +semptyArray :: KnownElt a => ShS sh -> Shaped (0 : sh) a +semptyArray sh = Shaped (memptyArray (shCvtSX sh)) + sshape :: forall sh a. Elt a => Shaped sh a -> ShS sh sshape (Shaped arr) = shCvtXS' (mshape arr) |