Mercurial > repos > public > sbplib_julia
comparison src/Grids/equidistant_grid.jl @ 1250:40ca0af6e480 refactor/grids
Add methods to change_length and fix incorrect function declaration
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 22 Feb 2023 12:43:36 +0100 |
| parents | 215f36712332 |
| children | ff8f335c32d1 |
comparison
equal
deleted
inserted
replaced
| 1249:215f36712332 | 1250:40ca0af6e480 |
|---|---|
| 124 """ | 124 """ |
| 125 change_length(::AbstractRange, n) | 125 change_length(::AbstractRange, n) |
| 126 | 126 |
| 127 Change the length of a range to `n`, keeping the same start and stop. | 127 Change the length of a range to `n`, keeping the same start and stop. |
| 128 """ | 128 """ |
| 129 function change_length(::AbstractRange, n) end | 129 function change_length end |
| 130 | 130 |
| 131 change_length(r::UnitRange, n) = StepRange{Int,Int}(range(r[begin], r[end], n)) | |
| 132 change_length(r::StepRange, n) = StepRange{Int,Int}(range(r[begin], r[end], n)) | |
| 133 change_length(r::StepRangeLen, n) = range(r[begin], r[end], n) | |
| 131 change_length(r::LinRange, n) = LinRange(r[begin], r[end], n) | 134 change_length(r::LinRange, n) = LinRange(r[begin], r[end], n) |
| 132 change_length(r::StepRangeLen, n) = range(r[begin], r[end], n) | |
| 133 # TODO: Test the above | 135 # TODO: Test the above |
