diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-05-20 17:38:25 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-20 17:38:25 +0200 |
commit | 03ef563a681fce281c07d03efc693ecd343cf23d (patch) | |
tree | 511eec4ca1168b314affe9d5f8acc44e263ef646 /src/Data/Array/Nested | |
parent | 697d4360aefee9e5142091e880e7384112a3419d (diff) |
rfromOrthotope
Diffstat (limited to 'src/Data/Array/Nested')
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index a05ff84..8f18724 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -28,7 +28,7 @@ {-| TODO: -* Write `rconst :: OR.Array n a -> Ranked n a` +(empty list) -} @@ -1403,6 +1403,12 @@ rtoList (Ranked arr) rtoList1 :: Elt a => Ranked 1 a -> [a] rtoList1 = map runScalar . rtoList +rfromOrthotope :: PrimElt a => SNat n -> S.Array n a -> Ranked n a +rfromOrthotope sn arr + | Refl <- lemRankReplicate sn + = let xarr = XArray arr + in Ranked (fromPrimitive (M_Primitive (X.shape (ssxFromSNat sn) xarr) xarr)) + runScalar :: Elt a => Ranked 0 a -> a runScalar arr = rindex arr ZIR |