diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-05-23 09:29:56 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-23 09:29:56 +0200 |
commit | 6af2f87bfc0fe7b11193c346115da70cddc244c5 (patch) | |
tree | 98770ceb37cf1aab5d801cc512052c56b8e26e4a /src/Data | |
parent | 8ab3e4a3de76305ef700f628ee9046b1c26355ed (diff) |
Use the {r,s}{from,to}Primitive utilities
Diffstat (limited to 'src/Data')
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index a96a268..3ff7967 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -911,7 +911,7 @@ mtoVectorP :: Storable a => Mixed sh (Primitive a) -> VS.Vector a mtoVectorP (M_Primitive _ v) = X.toVector v mtoVector :: PrimElt a => Mixed sh a -> VS.Vector a -mtoVector arr = mtoVectorP (coerce toPrimitive arr) +mtoVector arr = mtoVectorP (toPrimitive arr) mfromList1 :: Elt a => NonEmpty a -> Mixed '[Nothing] a mfromList1 = mfromListOuter . fmap mscalar -- TODO: optimise? @@ -1465,7 +1465,7 @@ rsumOuter1P (Ranked (M_Primitive sh arr)) rsumOuter1 :: forall n a. (Num a, PrimElt a) => Ranked (n + 1) a -> Ranked n a -rsumOuter1 = coerce fromPrimitive . rsumOuter1P @n @a . coerce toPrimitive +rsumOuter1 = rfromPrimitive . rsumOuter1P . rtoPrimitive rtranspose :: forall n a. Elt a => [Int] -> Ranked n a -> Ranked n a rtranspose perm arr @@ -1496,7 +1496,7 @@ rfromVectorP sh v = Ranked (mfromVectorP (shCvtRX sh) v) rfromVector :: forall n a. PrimElt a => IShR n -> VS.Vector a -> Ranked n a -rfromVector sh v = coerce fromPrimitive (rfromVectorP sh v) +rfromVector sh v = rfromPrimitive (rfromVectorP sh v) rtoVectorP :: Storable a => Ranked n (Primitive a) -> VS.Vector a rtoVectorP = coerce mtoVectorP @@ -1565,7 +1565,7 @@ rreplicateP sh x rreplicate :: forall n a. PrimElt a => IShR n -> a -> Ranked n a -rreplicate sh x = coerce fromPrimitive (rreplicateP sh x) +rreplicate sh x = rfromPrimitive (rreplicateP sh x) rslice :: forall n a. Elt a => Int -> Int -> Ranked (n + 1) a -> Ranked (n + 1) a rslice i n arr @@ -1746,7 +1746,7 @@ ssumOuter1P (Shaped (M_Primitive (SKnown sn :$% sh) arr)) = ssumOuter1 :: forall sh n a. (Num a, PrimElt a) => Shaped (n : sh) a -> Shaped sh a -ssumOuter1 = coerce fromPrimitive . ssumOuter1P @sh @n @a . coerce toPrimitive +ssumOuter1 = sfromPrimitive . ssumOuter1P . stoPrimitive lemCommMapJustTakeLen :: HList SNat is -> ShS sh -> X.TakeLen is (MapJust sh) :~: MapJust (X.TakeLen is sh) lemCommMapJustTakeLen HNil _ = Refl @@ -1810,7 +1810,7 @@ sfromVectorP :: Storable a => ShS sh -> VS.Vector a -> Shaped sh (Primitive a) sfromVectorP sh v = Shaped (mfromVectorP (shCvtSX sh) v) sfromVector :: PrimElt a => ShS sh -> VS.Vector a -> Shaped sh a -sfromVector sh v = coerce fromPrimitive (sfromVectorP sh v) +sfromVector sh v = sfromPrimitive (sfromVectorP sh v) stoVectorP :: Storable a => Shaped sh (Primitive a) -> VS.Vector a stoVectorP = coerce mtoVectorP @@ -1868,7 +1868,7 @@ sreplicateP :: forall sh a. Storable a => ShS sh -> a -> Shaped sh (Primitive a) sreplicateP sh x = Shaped (mreplicateP (shCvtSX sh) x) sreplicate :: PrimElt a => ShS sh -> a -> Shaped sh a -sreplicate sh x = coerce fromPrimitive (sreplicateP sh x) +sreplicate sh x = sfromPrimitive (sreplicateP sh x) sslice :: Elt a => SNat i -> SNat n -> Shaped (i + n + k : sh) a -> Shaped (n : sh) a sslice i n@SNat arr = |