From 5f6a64660b16d8f188caca5216e55debf4264611 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 10 Jun 2024 23:28:11 +0200 Subject: Add *flatten --- src/Data/Array/Nested/Internal/Mixed.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Data/Array/Nested/Internal/Mixed.hs') diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs index 9c2096d..69df52a 100644 --- a/src/Data/Array/Nested/Internal/Mixed.hs +++ b/src/Data/Array/Nested/Internal/Mixed.hs @@ -796,6 +796,9 @@ mreshape sh' arr = (\sshIn -> X.reshapePartial (ssxFromShape (mshape arr)) sshIn sh') arr +mflatten :: Elt a => Mixed sh a -> Mixed '[Flatten sh] a +mflatten arr = mreshape (shxFlatten (mshape arr) :$% ZSX) arr + miota :: (Enum a, PrimElt a) => SNat n -> Mixed '[Just n] a miota sn = fromPrimitive $ M_Primitive (SKnown sn :$% ZSX) (X.iota sn) -- cgit v1.2.3-70-g09d2