Created
May 9, 2017 17:07
-
-
Save getzdan/aa287ce691673d40c9f953dfc23ad038 to your computer and use it in GitHub Desktop.
a quick method for generating grid of matrix subscripts
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
function f6(xs, ys) | |
lx, ly = length(xs), length(ys) | |
lxly = lx*ly | |
res = Array{Base.promote_eltype(xs, ys), 2}(lxly, 2) | |
ind = 1 | |
while ind<=lxly | |
@inbounds for x in xs | |
res[ind] = x | |
ind += 1 | |
end | |
end | |
for y in ys | |
@inbounds for i=1:lx | |
res[ind] = y | |
ind += 1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment