Skip to content

Commit 421dbdf

Browse files
committed
Rename logspace to logrange
While the accuracy of terminology argument doesn't apply as strongly to this function as it does for `linspace`, it still makes sense to make this name match its `lin*` counterpart.
1 parent 13e3ee7 commit 421dbdf

File tree

8 files changed

+18
-15
lines changed

8 files changed

+18
-15
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,8 @@ Deprecated or removed
978978
* `linspace` and `LinSpace` have been renamed to `linrange` and `LinRange`, respectively
979979
([#TODO]).
980980

981+
* `logspace` has been renamed to `logrange` ([#TODO]).
982+
981983
* `similar(::Associative)` has been deprecated in favor of `empty(::Associative)`, and
982984
`similar(::Associative, ::Pair{K, V})` has been deprecated in favour of
983985
`empty(::Associative, K, V)` ([#24390]).

base/deprecated.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,10 +897,11 @@ end
897897

898898
# issue #24794
899899
@deprecate linspace(start, stop) linrange(start, stop, 50)
900-
@deprecate logspace(start, stop) logspace(start, stop, 50)
900+
@deprecate logspace(start, stop) logrange(start, stop, 50)
901901

902902
@deprecate linspace linrange
903903
@deprecate_binding LinSpace LinRange
904+
@deprecate logspace logrange
904905

905906
@deprecate merge!(repo::LibGit2.GitRepo, args...; kwargs...) LibGit2.merge!(repo, args...; kwargs...)
906907
@deprecate push!(w::LibGit2.GitRevWalker, arg) LibGit2.push!(w, arg)

base/exports.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ export
401401
last,
402402
linearindices,
403403
linrange,
404-
logspace,
404+
logrange,
405405
mapslices,
406406
max,
407407
maximum!,

base/range.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ StepRangeLen(ref::R, step::S, len::Integer, offset::Integer = 1) where {R,S} =
211211
StepRangeLen{T}(ref::R, step::S, len::Integer, offset::Integer = 1) where {T,R,S} =
212212
StepRangeLen{T,R,S}(ref, step, len, offset)
213213

214-
## linrange and logspace
214+
## linrange and logrange
215215

216216
struct LinRange{T} <: AbstractRange{T}
217217
start::T
@@ -321,20 +321,20 @@ function print_range(io::IO, r::AbstractRange,
321321
end
322322

323323
"""
324-
logspace(start::Real, stop::Real, n::Integer; base=10)
324+
logrange(start::Real, stop::Real, n::Integer; base=10)
325325
326326
Construct a vector of `n` logarithmically spaced numbers from `base^start` to `base^stop`.
327327
328328
```jldoctest
329-
julia> logspace(1.,10.,5)
329+
julia> logrange(1.,10.,5)
330330
5-element Array{Float64,1}:
331331
10.0
332332
1778.2794100389228
333333
316227.7660168379
334334
5.623413251903491e7
335335
1.0e10
336336
337-
julia> logspace(1.,10.,5,base=2)
337+
julia> logrange(1.,10.,5,base=2)
338338
5-element Array{Float64,1}:
339339
2.0
340340
9.513656920021768
@@ -343,7 +343,7 @@ julia> logspace(1.,10.,5,base=2)
343343
1024.0
344344
```
345345
"""
346-
logspace(start::Real, stop::Real, n::Integer; base=10) = base.^linrange(start, stop, n)
346+
logrange(start::Real, stop::Real, n::Integer; base=10) = base.^linrange(start, stop, n)
347347

348348
## interface implementations
349349

doc/src/base/arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Base.fill!
3333
Base.similar(::AbstractArray)
3434
Base.similar(::Any, ::Tuple)
3535
Base.linrange
36-
Base.logspace
36+
Base.logrange
3737
```
3838

3939
## Basic functions

examples/lru_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ get_str(i) = String(vcat(map(x->[x>>4; x&0x0F], reinterpret(UInt8, [Int32(i)])).
1010
isbounded(::Type{L}) where {L<:LRUExample.LRU} = any(map(n->n==:maxsize, fieldnames(L)))
1111
isbounded(l::L) where {L<:LRUExample.LRU} = isbounded(L)
1212

13-
nmax = round.(Int, logspace(2, 5, 4))
13+
nmax = round.(Int, logrange(2, 5, 4))
1414

1515
function lrutest()
1616
#println("LRU consistency tests")

test/compiler/compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ tpara18457(::Type{A}) where {A<:AbstractMyType18457} = tpara18457(supertype(A))
585585

586586
function FOO_19322(Y::AbstractMatrix; frac::Float64=0.3, nbins::Int=100, n_sims::Int=100)
587587
num_iters, num_chains = size(Y)
588-
start_iters = unique([1; [round(Int64, s) for s in logspace(log(10,100),
588+
start_iters = unique([1; [round(Int64, s) for s in logrange(log(10,100),
589589
log(10,num_iters/2),nbins-1)]])
590590
result = zeros(Float64, 10, length(start_iters) * num_chains)
591591
j=1

test/ranges.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,14 +1210,14 @@ end
12101210
@test Float32(linsp.ref) linsp.ref.hi + linsp.ref.lo
12111211
end
12121212

1213-
@testset "logspace" begin
1213+
@testset "logrange" begin
12141214
n = 10; a = 2; b = 4
12151215
# test default values; base = 10
1216-
@test logspace(a, b, 50) == 10 .^ linrange(a, b, 50)
1217-
@test logspace(a, b, n) == 10 .^ linrange(a, b, n)
1216+
@test logrange(a, b, 50) == 10 .^ linrange(a, b, 50)
1217+
@test logrange(a, b, n) == 10 .^ linrange(a, b, n)
12181218
for base in (10, 2, ℯ)
1219-
@test logspace(a, b, 50, base=base) == base.^linrange(a, b, 50)
1220-
@test logspace(a, b, n, base=base) == base.^linrange(a, b, n)
1219+
@test logrange(a, b, 50, base=base) == base.^linrange(a, b, 50)
1220+
@test logrange(a, b, n, base=base) == base.^linrange(a, b, n)
12211221
end
12221222
end
12231223

0 commit comments

Comments
 (0)