Created
September 11, 2015 15:23
-
-
Save anthonyclays/802da7fdb17f4db6d718 to your computer and use it in GitHub Desktop.
Vector partitioning into n chunks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chunks(l::AbstractVector, n::Int) = let part_l = length(l) / n | |
[let start = floor(Int, (i-1)*part_l + 1), stop = floor(Int, i*part_l); | |
l[start:stop] end for i in 1:n] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment