diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-09 21:06:13 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-09 21:06:13 +0200 |
commit | f70a381a05ec86767365b7d16b674ceff318d07d (patch) | |
tree | 09cbcf7877ca24df087978cdfb50175a80be5080 /src/Data/Array/Nested/Internal/Mixed.hs | |
parent | 5763bf70dc67c5437207ff8e9dd08585d2ea5384 (diff) |
nest, unNest
Diffstat (limited to 'src/Data/Array/Nested/Internal/Mixed.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Mixed.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs index 6d601b8..b799190 100644 --- a/src/Data/Array/Nested/Internal/Mixed.hs +++ b/src/Data/Array/Nested/Internal/Mixed.hs @@ -686,6 +686,12 @@ mfromListPrimLinear sh l = munScalar :: Elt a => Mixed '[] a -> a munScalar arr = mindex arr ZIX +mnest :: forall sh sh' a. Elt a => StaticShX sh -> Mixed (sh ++ sh') a -> Mixed sh (Mixed sh' a) +mnest ssh arr = M_Nest (fst (shxSplitApp (Proxy @sh') ssh (mshape arr))) arr + +munNest :: Mixed sh (Mixed sh' a) -> Mixed (sh ++ sh') a +munNest (M_Nest _ arr) = arr + mrerankP :: forall sh1 sh2 sh a b. (Storable a, Storable b) => StaticShX sh -> IShX sh2 -> (Mixed sh1 (Primitive a) -> Mixed sh2 (Primitive b)) |