Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1343:fa3695f634de refactor/grids
More clean up of todos and notes
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Mon, 15 May 2023 22:37:33 +0200 |
| parents | c0c1189c5f2e |
| children | 760a4a1ec4b7 |
comparison
equal
deleted
inserted
replaced
| 1342:c0c1189c5f2e | 1343:fa3695f634de |
|---|---|
| 80 | 80 |
| 81 Lazy evaluation `f` on the grid. `f` can either be on the form `f(x,y,...)` | 81 Lazy evaluation `f` on the grid. `f` can either be on the form `f(x,y,...)` |
| 82 with each coordinate as an argument, or on the form `f(x̄)` taking a | 82 with each coordinate as an argument, or on the form `f(x̄)` taking a |
| 83 coordinate vector. | 83 coordinate vector. |
| 84 | 84 |
| 85 TODO: Mention map(f,g) if you want a concrete array | 85 If the goal is a concrete array `map(f,g)` can be used instead. |
| 86 """ | 86 """ |
| 87 eval_on(g::Grid, f) = eval_on(g, f, Base.IteratorSize(g)) # TBD: Borde f vara först som i alla map, sum, och dylikt | 87 eval_on(g::Grid, f) = eval_on(g, f, Base.IteratorSize(g)) |
| 88 function eval_on(g::Grid, f, ::Base.HasShape) | 88 function eval_on(g::Grid, f, ::Base.HasShape) |
| 89 if hasmethod(f, (Any,)) | 89 if hasmethod(f, (Any,)) |
| 90 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]), size(g)) | 90 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]), size(g)) |
| 91 else | 91 else |
| 92 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]...), size(g)) | 92 return LazyTensors.LazyFunctionArray((I...)->f(g[I...]...), size(g)) |
