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/Shaped.hs | |
| parent | 01ecb3a74f3fd4fafebd47d8669136efe9aaad07 (diff) | |
Add mtoListPrimLinear and friends
Diffstat (limited to 'src/Data/Array/Nested/Shaped.hs')
| -rw-r--r-- | src/Data/Array/Nested/Shaped.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Data/Array/Nested/Shaped.hs b/src/Data/Array/Nested/Shaped.hs index a0addec..6034dc7 100644 --- a/src/Data/Array/Nested/Shaped.hs +++ b/src/Data/Array/Nested/Shaped.hs @@ -171,15 +171,21 @@ sfromList1Prim = coerce mfromList1PrimSN sfromListPrimLinear :: forall sh a. PrimElt a => ShS sh -> [a] -> Shaped sh a sfromListPrimLinear sh l = Shaped (mfromListPrimLinear (shxFromShS sh) l) -stoList :: Elt a => Shaped '[n] a -> [a] -stoList = map sunScalar . stoListOuter - stoListOuter :: Elt a => Shaped (n : sh) a -> [Shaped sh a] stoListOuter (Shaped arr) = coerce (mtoListOuter arr) +stoList :: Elt a => Shaped '[n] a -> [a] +stoList = map sunScalar . stoListOuter + stoListLinear :: Elt a => Shaped sh a -> [a] stoListLinear (Shaped arr) = mtoListLinear arr +stoListPrim :: PrimElt a => Shaped '[n] a -> [a] +stoListPrim (Shaped arr) = mtoListPrim arr + +stoListPrimLinear :: PrimElt a => Shaped sh a -> [a] +stoListPrimLinear (Shaped arr) = mtoListPrimLinear arr + sfromOrthotope :: PrimElt a => ShS sh -> SS.Array sh a -> Shaped sh a sfromOrthotope sh (SS.A (SG.A arr)) = Shaped (fromPrimitive (M_Primitive (shxFromShS sh) (X.XArray (RS.A (RG.A (shsToList sh) arr))))) |
