Mercurial > repos > public > sbplib_julia
comparison test/Grids/grid_test.jl @ 1529:43aaf710463e refactor/equidistant_grid/signature
Change to signature of equidistant_grid to same style as many array methods.
See for example Array{T}(undef, dims...), zeros(T, dims...), fill(a, dims...) and more.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 11 Apr 2024 22:31:04 +0200 |
parents | 0cd6cf62af93 |
children | 471a948cd2b2 |
comparison
equal
deleted
inserted
replaced
1528:d641798539c2 | 1529:43aaf710463e |
---|---|
45 | 45 |
46 @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) isa LazyArray | 46 @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) isa LazyArray |
47 @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) == 2 .* range(0,1,length=4) | 47 @test eval_on(EquidistantGrid(range(0,1,length=4)), x->2x) == 2 .* range(0,1,length=4) |
48 | 48 |
49 | 49 |
50 g = equidistant_grid((5,3), (0.0,0.0), (2.0,1.0)) | 50 g = equidistant_grid((0.0,0.0), (2.0,1.0), 5, 3) |
51 | 51 |
52 @test eval_on(g, x̄ -> 0.) isa LazyArray | 52 @test eval_on(g, x̄ -> 0.) isa LazyArray |
53 @test eval_on(g, x̄ -> 0.) == fill(0., (5,3)) | 53 @test eval_on(g, x̄ -> 0.) == fill(0., (5,3)) |
54 | 54 |
55 @test eval_on(g, x̄ -> sin(x̄[1])*cos(x̄[2])) == map(x̄->sin(x̄[1])*cos(x̄[2]), g) | 55 @test eval_on(g, x̄ -> sin(x̄[1])*cos(x̄[2])) == map(x̄->sin(x̄[1])*cos(x̄[2]), g) |