Skip to content

Commit

Permalink
Use range not LinRange (#16)
Browse files Browse the repository at this point in the history
* Test range

* Use Julia v1.7

* v0.5
  • Loading branch information
JeffFessler authored Nov 27, 2022
1 parent 17663b8 commit 09f040a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['1.6', '1', 'nightly']
version: ['1.7', '1', 'nightly']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name = "LazyGrids"
uuid = "7031d0ef-c40d-4431-b2f8-61a8d2f650db"
authors = ["Sheehan Olver <[email protected]>", "Jeff Fessler <[email protected]>"]
version = "0.4.0"
version = "0.5.0"

[deps]
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
julia = "1.6"
julia = "1.7"
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ julia> yg
3.0 3.5 4.0
3.0 3.5 4.0

julia> x = LinRange(-1,1,1001)
1001-element LinRange{Float64}: ...
julia> x = range(-1,1,1001)
-1.0:0.002:1.0

julia> (xg, yg, zg) = ndgrid(x, x, x)
{... lots of output ...}
Expand All @@ -65,6 +65,11 @@ julia> sizeof(xg) # show number of bytes used
* https://github.com/JuliaArrays/RangeArrays.jl


### Compatibility

Tested with Julia ≥ 1.7.


<!-- URLs -->
[action-img]: https://github.com/JuliaArrays/LazyGrids.jl/workflows/CI/badge.svg
[action-url]: https://github.com/JuliaArrays/LazyGrids.jl/actions
Expand Down
4 changes: 2 additions & 2 deletions test/ndgrid-avect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using LazyGrids: ndgrid, ndgrid_array, GridAV, GridUR
using Test: @test, @testset, @test_throws, @inferred

@testset "avect" begin
(x, y, z) = ([:a,:b,:c], LinRange(0,1,4), 5:9)
(x, y, z) = ([:a,:b,:c], range(0,1,4), 5:9)
(xa, ya, za) = @inferred ndgrid_array(x, y, z)
(xl, yl, zl) = @inferred ndgrid(x, y, z)

Expand All @@ -13,7 +13,7 @@ using Test: @test, @testset, @test_throws, @inferred
@test eltype(zl) === eltype(z)
@test size(xl) === (length(x), length(y), length(z))
@test xl isa GridAV
@test yl isa GridAR
@test yl isa GridSL
@test zl isa GridUR
@test xl == xa
@test yl ya
Expand Down
12 changes: 10 additions & 2 deletions test/ndgrid-range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@ end


@testset "range" begin
(x, y, z) = (LinRange(0,1,4), 1:1//2:3, 6:9)
(x, y) = (range(6,9,4), LinRange(0,1,4))
(xl, yl) = @inferred ndgrid(x, y)
@test eltype(xl) === eltype(x)
@test eltype(yl) === eltype(y)
@test size(xl) === (length(x), length(y))
@test xl isa GridSL
@test yl isa GridAR

(x, y, z) = (range(0,1,4), 1:1//2:3, 6:9)
(xa, ya, za) = @inferred ndgrid_array(x, y, z)
(xl, yl, zl) = @inferred ndgrid(x, y, z)

@test eltype(xl) === eltype(x)
@test eltype(yl) === eltype(y)
@test eltype(zl) === eltype(z)
@test size(xl) === (length(x), length(y), length(z))
@test xl isa GridAR
@test xl isa GridSL
@test yl isa GridAR
@test zl isa GridUR
@test xl xa
Expand Down

2 comments on commit 09f040a

@JeffFessler
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator() register

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/72968

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.0 -m "<description of version>" 09f040ab500da006c10e4711223d5676ab0be229
git push origin v0.5.0

Please sign in to comment.