diff options
| author | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2026-02-10 11:48:45 +0100 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-03-14 12:08:05 +0100 |
| commit | 1c99e9ff0d18e323fe159e54af9775c46d4abd76 (patch) | |
| tree | 7974f1c83e7947bfb880c81f4c6fe85c7611c333 /src/Data/Array/Nested/Mixed.hs | |
| parent | 01ecb3a74f3fd4fafebd47d8669136efe9aaad07 (diff) | |
Add mtoListPrimLinear and friends
Diffstat (limited to 'src/Data/Array/Nested/Mixed.hs')
| -rw-r--r-- | src/Data/Array/Nested/Mixed.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Mixed.hs b/src/Data/Array/Nested/Mixed.hs index 95eee9c..0766e8c 100644 --- a/src/Data/Array/Nested/Mixed.hs +++ b/src/Data/Array/Nested/Mixed.hs @@ -939,7 +939,13 @@ mtoList :: Elt a => Mixed '[n] a -> [a] mtoList = map munScalar . mtoListOuter mtoListLinear :: Elt a => Mixed sh a -> [a] -mtoListLinear arr = map (mindex arr) (shxEnum (mshape arr)) -- TODO: optimise +mtoListLinear arr = map (mindex arr) (shxEnum (mshape arr)) + +mtoListPrim :: PrimElt a => Mixed '[n] a -> [a] +mtoListPrim (toPrimitive -> M_Primitive _ arr) = X.toListLinear arr + +mtoListPrimLinear :: PrimElt a => Mixed sh a -> [a] +mtoListPrimLinear (toPrimitive -> M_Primitive _ arr) = X.toListLinear arr munScalar :: Elt a => Mixed '[] a -> a munScalar arr = mindex arr ZIX |
