Skip to content
Snippets Groups Projects
Commit 0dfdc026 authored by Pierre Navaro's avatar Pierre Navaro
Browse files

remove ndgrids

parent e97b8572
Branches
No related tags found
No related merge requests found
export ndgrid, ndgrid_fill!
ndgrid(v::AbstractVector) = copy(v)
function ndgrid(v1::AbstractVector{T}, v2::AbstractVector{T}) where T
m, n = length(v1), length(v2)
v1 = reshape(v1, m, 1)
v2 = reshape(v2, 1, n)
(repmat(v1, 1, n), repmat(v2, m, 1))
end
function ndgrid_fill!(a, v, s, snext)
for j = 1:length(a)
a[j] = v[div(rem(j-1, snext), s)+1]
end
end
function ndgrid(v1::AbstractVector{T}...) where T
n = length(vs)
sz = map(length, vs)
out = ntuple(i->Array{T}(sz), n)
s = 1
for i=1:n
a = out[i]::Array
v = vs[i]
snext = s * size(a,i)
ndgrid_fill(a, v, s, snext)
s = snext
end
out
end
...@@ -3,7 +3,6 @@ using HermiteGF ...@@ -3,7 +3,6 @@ using HermiteGF
using Test using Test
include("trapz.jl") include("trapz.jl")
include("ndgrid.jl")
include("test_interpolation1d.jl") include("test_interpolation1d.jl")
include("test_interpolation2d.jl") include("test_interpolation2d.jl")
include("test_interpolation3d.jl") include("test_interpolation3d.jl")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment