From d0b8d7c8935dc1bf6fbb09c752707a82bc066808 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 14 May 2024 13:01:22 +0200 Subject: rev1 --- src/Data/Array/Nested/Internal.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Data/Array/Nested') diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index 4a03548..350eb6f 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -537,6 +537,9 @@ mconstant sh x = fromPrimitive (mconstantP sh x) mslice :: (KnownShapeX sh, Elt a) => [(Int, Int)] -> Mixed sh a -> Mixed sh a mslice ivs = mlift $ \_ -> X.slice ivs +mrev1 :: (KnownShapeX (n : sh), Elt a) => Mixed (n : sh) a -> Mixed (n : sh) a +mrev1 = mlift $ \_ -> X.rev1 + mliftPrim :: (KnownShapeX sh, Storable a) => (a -> a) -> Mixed sh (Primitive a) -> Mixed sh (Primitive a) @@ -1077,6 +1080,9 @@ rconstant sh x = coerce fromPrimitive (rconstantP sh x) rslice :: (KnownINat n, Elt a) => [(Int, Int)] -> Ranked n a -> Ranked n a rslice ivs = rlift $ \_ -> X.slice ivs +rrev1 :: (KnownINat n, Elt a) => Ranked (S n) a -> Ranked (S n) a +rrev1 = rlift $ \_ -> X.rev1 + -- ====== API OF SHAPED ARRAYS ====== -- @@ -1283,3 +1289,6 @@ sconstant x = coerce fromPrimitive (sconstantP @sh x) sslice :: (KnownShape sh, Elt a) => [(Int, Int)] -> Shaped sh a -> Shaped sh a sslice ivs = slift $ \_ -> X.slice ivs + +srev1 :: (KnownNat n, KnownShape sh, Elt a) => Shaped (n : sh) a -> Shaped (n : sh) a +srev1 = slift $ \_ -> X.rev1 -- cgit v1.2.3-70-g09d2