Home

Awesome

LazyGrids.jl

A Julia package for representing multi-dimensional grids.

https://github.com/JuliaArrays/LazyGrids.jl

docs-stable docs-dev action status pkgeval status codecov license Aqua QA code-style deps version pkgeval

Methods

This package exports the following methods:

See the documentation linked in the blue badges above for examples, and for a 1-line lazy version of meshgrid.

As shown in the examples, the lazy version typically is as fast, if not faster, than using conventional dense Array objects.

Example

julia> using LazyGrids
(xg, yg) = ndgrid(1:2, 3:0.5:4)
([1 1 1; 2 2 2], [3.0 3.5 4.0; 3.0 3.5 4.0])

julia> xg
2×3 LazyGrids.GridUR{Int64, 1, 2}:
 1  1  1
 2  2  2

julia> yg
2×3 LazyGrids.GridSL{Float64, 2, 2, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}:
 3.0  3.5  4.0
 3.0  3.5  4.0

julia> x = range(-1,1,1001)
-1.0:0.002:1.0

julia> (xg, yg, zg) = ndgrid(x, x, x)
{... lots of output ...}

julia> size(xg) # show array dimensions
(1001, 1001, 1001)

julia> sizeof(xg) # show number of bytes used
72

Related packages

Compatibility

Tested with Julia ≥ 1.10.

<!-- URLs -->