From 7e5ccb3402f97c1c7cff158147aeb863d429f885 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 21 Nov 2024 13:49:25 +0100 Subject: [rsm]emptyArray --- src/Data/Array/Nested/Internal/Ranked.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Data/Array/Nested/Internal/Ranked.hs') diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs index 39a6018..9e8a7b2 100644 --- a/src/Data/Array/Nested/Internal/Ranked.hs +++ b/src/Data/Array/Nested/Internal/Ranked.hs @@ -165,11 +165,11 @@ instance Elt a => Elt (Ranked n a) where vecs) instance (KnownNat n, KnownElt a) => KnownElt (Ranked n a) where - memptyArray :: forall sh. IShX sh -> Mixed sh (Ranked n a) - memptyArray i + memptyArrayUnsafe :: forall sh. IShX sh -> Mixed sh (Ranked n a) + memptyArrayUnsafe i | Dict <- lemKnownReplicate (SNat @n) = coerce @(Mixed sh (Mixed (Replicate n Nothing) a)) @(Mixed sh (Ranked n a)) $ - memptyArray i + memptyArrayUnsafe i mvecsUnsafeNew idx (Ranked arr) | Dict <- lemKnownReplicate (SNat @n) @@ -229,6 +229,9 @@ instance (FloatElt a, NumElt a, PrimElt a, Num a) => Floating (Ranked n a) where log1mexp = arithPromoteRanked GHC.Float.log1mexp +remptyArray :: KnownElt a => Ranked 1 a +remptyArray = mtoRanked (memptyArray ZSX) + rshape :: Elt a => Ranked n a -> IShR n rshape (Ranked arr) = shCvtXR' (mshape arr) -- cgit v1.2.3-70-g09d2