Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:1009061
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
slice :: (Slice sh, Shape sh, Elt a) => Int -> Int -> Array (sh :. Int) a -> Array (sh :. Int) a
slice from to array =
fromFunction (z :. (to - from + 1)) (\(z :. ix) -> array ! (z :. (ix + from)))
where (z :. _) = extent array
 
cumsum ::
(FullShape uf ~ uf,
Slice uf,
Slice (SliceShape uf),
Shape uf,
Shape (SliceShape uf),
Elt a,
Num a) =>
Array (uf :. Int) a -> Array (uf :. Int) a
cumsum array = traverse array id $ cumsum' array
where
cumsum' array f (sh :. outer) =
Repa.sumAll $
Surf.slice 0 outer $
Repa.slice array (sh :. All)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.