Skip to content

Commit 19c8b14

Browse files
committed
Rename LinSpace to LinRange
This name more accurately reflects what's being constructed. It's likely that the name `LinSpace` was chosen for Julia since it matches what's used by Matlab. NumPy uses this name as well, but they likely also chose it for Matlab familiarity. In Matlab, the name `linspace` is short for "linearly spaced," and it returns a vector of linearly spaced elements. In Julia, we're often more careful with our terminology: in this case, the returned object is an `AbstractRange`, not some kind of vector space or any other kind of space. Thus calling it `LinRange` is more indicative of the functionality.
1 parent 6c0e39d commit 19c8b14

File tree

11 files changed

+86
-83
lines changed

11 files changed

+86
-83
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,8 @@ Deprecated or removed
10401040
* `linspace` has been deprecated in favor of `range` with `stop` and `length` keyword
10411041
arguments ([#25896]).
10421042

1043+
* `LinSpace` has been renamed to `LinRange` ([#25896]).
1044+
10431045
* `endof(a)` has been renamed to `lastindex(a)`, and the `end` keyword in indexing expressions now
10441046
lowers to either `lastindex(a)` (in the case with only one index) or `lastindex(a, d)` (in cases
10451047
where there is more than one index and `end` appears at dimension `d`) ([#23554], [#25763]).

base/abstractarray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ of_indices(x, y) = similar(dims->y, oftype(axes(x), axes(y)))
883883
map(::Type{T}, r::StepRange) where {T<:Real} = T(r.start):T(r.step):T(last(r))
884884
map(::Type{T}, r::UnitRange) where {T<:Real} = T(r.start):T(last(r))
885885
map(::Type{T}, r::StepRangeLen) where {T<:AbstractFloat} = convert(StepRangeLen{T}, r)
886-
function map(::Type{T}, r::LinSpace) where T<:AbstractFloat
887-
LinSpace(T(r.start), T(r.stop), length(r))
886+
function map(::Type{T}, r::LinRange) where T<:AbstractFloat
887+
LinRange(T(r.start), T(r.stop), length(r))
888888
end
889889

890890
## unsafe/pointer conversions ##

base/deprecated.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@ export readandwrite
13171317
@deprecate range(start, step, length) range(start, step=step, length=length)
13181318
@deprecate linspace(start, stop, length::Integer) range(start, stop=stop, length=length)
13191319
@deprecate linspace(start, stop, length::Real) range(start, stop=stop, length=Int(length))
1320+
@deprecate_binding LinSpace LinRange
13201321

13211322
@deprecate runtests(tests, ncores; kw...) runtests(tests; ncores = ncores, kw...) false
13221323
@deprecate code_lowered(f, types, generated) code_lowered(f, types, generated = generated)

base/exports.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export
5252
BitSet,
5353
IOBuffer,
5454
IOStream,
55-
LinSpace,
55+
LinRange,
5656
Irrational,
5757
Matrix,
5858
MergeSort,

base/float.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,8 @@ float(r::StepRange) = float(r.start):float(r.step):float(last(r))
874874
float(r::UnitRange) = float(r.start):float(last(r))
875875
float(r::StepRangeLen{T}) where {T} =
876876
StepRangeLen{typeof(float(T(r.ref)))}(float(r.ref), float(r.step), length(r), r.offset)
877-
function float(r::LinSpace)
878-
LinSpace(float(r.start), float(r.stop), length(r))
877+
function float(r::LinRange)
878+
LinRange(float(r.start), float(r.stop), length(r))
879879
end
880880

881881
# big, broadcast over arrays
@@ -884,6 +884,6 @@ function big end # no prior definitions of big in sysimg.jl, necessitating this
884884
broadcast(::typeof(big), r::UnitRange) = big(r.start):big(last(r))
885885
broadcast(::typeof(big), r::StepRange) = big(r.start):big(r.step):big(last(r))
886886
broadcast(::typeof(big), r::StepRangeLen) = StepRangeLen(big(r.ref), big(r.step), length(r), r.offset)
887-
function broadcast(::typeof(big), r::LinSpace)
888-
LinSpace(big(r.start), big(r.stop), length(r))
887+
function broadcast(::typeof(big), r::LinRange)
888+
LinRange(big(r.start), big(r.stop), length(r))
889889
end

base/range.jl

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ StepRangeLen{T}(ref::R, step::S, len::Integer, offset::Integer = 1) where {T,R,S
237237

238238
## range with computed step, and logspace
239239

240-
struct LinSpace{T} <: AbstractRange{T}
240+
struct LinRange{T} <: AbstractRange{T}
241241
start::T
242242
stop::T
243243
len::Int
244244
lendiv::Int
245245

246-
function LinSpace{T}(start,stop,len) where T
246+
function LinRange{T}(start,stop,len) where T
247247
len >= 0 || throw(ArgumentError("range($start, stop=$stop, length=$len): negative length"))
248248
if len == 1
249249
start == stop || throw(ArgumentError("range($start, stop=$stop, length=$len): endpoints differ"))
@@ -253,22 +253,22 @@ struct LinSpace{T} <: AbstractRange{T}
253253
end
254254
end
255255

256-
function LinSpace(start, stop, len::Integer)
256+
function LinRange(start, stop, len::Integer)
257257
T = typeof((stop-start)/len)
258-
LinSpace{T}(start, stop, len)
258+
LinRange{T}(start, stop, len)
259259
end
260260

261261
function _range(start::T, ::Nothing, stop::S, len::Integer) where {T,S}
262262
a, b = promote(start, stop)
263263
_range(a, nothing, b, len)
264264
end
265-
_range(start::T, ::Nothing, stop::T, len::Integer) where {T<:Real} = LinSpace{T}(start, stop, len)
266-
_range(start::T, ::Nothing, stop::T, len::Integer) where {T} = LinSpace{T}(start, stop, len)
265+
_range(start::T, ::Nothing, stop::T, len::Integer) where {T<:Real} = LinRange{T}(start, stop, len)
266+
_range(start::T, ::Nothing, stop::T, len::Integer) where {T} = LinRange{T}(start, stop, len)
267267
_range(start::T, ::Nothing, stop::T, len::Integer) where {T<:Integer} =
268268
_linspace(Float64, start, stop, len, 1)
269269
## for Float16, Float32, and Float64 see twiceprecision.jl
270270

271-
function show(io::IO, r::LinSpace)
271+
function show(io::IO, r::LinRange)
272272
print(io, "range(")
273273
show(io, first(r))
274274
print(io, ", stop=")
@@ -368,7 +368,7 @@ isempty(r::StepRange) =
368368
(r.start != r.stop) & ((r.step > zero(r.step)) != (r.stop > r.start))
369369
isempty(r::AbstractUnitRange) = first(r) > last(r)
370370
isempty(r::StepRangeLen) = length(r) == 0
371-
isempty(r::LinSpace) = length(r) == 0
371+
isempty(r::LinRange) = length(r) == 0
372372

373373
"""
374374
step(r)
@@ -391,7 +391,7 @@ julia> step(range(2.5, stop=10.9, length=85))
391391
step(r::StepRange) = r.step
392392
step(r::AbstractUnitRange) = 1
393393
step(r::StepRangeLen{T}) where {T} = T(r.step)
394-
step(r::LinSpace) = (last(r)-first(r))/r.lendiv
394+
step(r::LinRange) = (last(r)-first(r))/r.lendiv
395395

396396
step_hp(r::StepRangeLen) = r.step
397397
step_hp(r::AbstractRange) = step(r)
@@ -408,7 +408,7 @@ unsafe_length(r::OneTo) = r.stop
408408
length(r::AbstractUnitRange) = unsafe_length(r)
409409
length(r::OneTo) = unsafe_length(r)
410410
length(r::StepRangeLen) = r.len
411-
length(r::LinSpace) = r.len
411+
length(r::LinRange) = r.len
412412

413413
function length(r::StepRange{T}) where T<:Union{Int,UInt,Int64,UInt64}
414414
isempty(r) && return zero(T)
@@ -448,11 +448,11 @@ end
448448
first(r::OrdinalRange{T}) where {T} = convert(T, r.start)
449449
first(r::OneTo{T}) where {T} = oneunit(T)
450450
first(r::StepRangeLen) = unsafe_getindex(r, 1)
451-
first(r::LinSpace) = r.start
451+
first(r::LinRange) = r.start
452452

453453
last(r::OrdinalRange{T}) where {T} = convert(T, r.stop)
454454
last(r::StepRangeLen) = unsafe_getindex(r, length(r))
455-
last(r::LinSpace) = r.stop
455+
last(r::LinRange) = r.stop
456456

457457
minimum(r::AbstractUnitRange) = isempty(r) ? throw(ArgumentError("range must be non-empty")) : first(r)
458458
maximum(r::AbstractUnitRange) = isempty(r) ? throw(ArgumentError("range must be non-empty")) : last(r)
@@ -465,9 +465,9 @@ copy(r::AbstractRange) = r
465465

466466
## iteration
467467

468-
start(r::LinSpace) = 1
469-
done(r::LinSpace, i::Int) = length(r) < i
470-
function next(r::LinSpace, i::Int)
468+
start(r::LinRange) = 1
469+
done(r::LinRange, i::Int) = length(r) < i
470+
function next(r::LinRange, i::Int)
471471
@_inline_meta
472472
unsafe_getindex(r, i), i+1
473473
end
@@ -526,7 +526,7 @@ function getindex(v::AbstractRange{T}, i::Integer) where T
526526
ret
527527
end
528528

529-
function getindex(r::Union{StepRangeLen,LinSpace}, i::Integer)
529+
function getindex(r::Union{StepRangeLen,LinRange}, i::Integer)
530530
@_inline_meta
531531
@boundscheck checkbounds(r, i)
532532
unsafe_getindex(r, i)
@@ -543,7 +543,7 @@ function _getindex_hiprec(r::StepRangeLen, i::Integer) # without rounding by T
543543
r.ref + u*r.step
544544
end
545545

546-
function unsafe_getindex(r::LinSpace, i::Integer)
546+
function unsafe_getindex(r::LinRange, i::Integer)
547547
lerpi.(i-1, r.lendiv, r.start, r.stop)
548548
end
549549

@@ -593,12 +593,12 @@ function getindex(r::StepRangeLen{T}, s::OrdinalRange{<:Integer}) where {T}
593593
return StepRangeLen{T}(ref, r.step*step(s), length(s), offset)
594594
end
595595

596-
function getindex(r::LinSpace, s::OrdinalRange{<:Integer})
596+
function getindex(r::LinRange, s::OrdinalRange{<:Integer})
597597
@_inline_meta
598598
@boundscheck checkbounds(r, s)
599599
vfirst = unsafe_getindex(r, first(s))
600600
vlast = unsafe_getindex(r, last(s))
601-
return LinSpace(vfirst, vlast, length(s))
601+
return LinRange(vfirst, vlast, length(s))
602602
end
603603

604604
show(io::IO, r::AbstractRange) = print(io, repr(first(r)), ':', repr(step(r)), ':', repr(last(r)))
@@ -609,7 +609,7 @@ show(io::IO, r::OneTo) = print(io, "Base.OneTo(", r.stop, ")")
609609
(first(r) == first(s)) & (step(r) == step(s)) & (last(r) == last(s))
610610
==(r::OrdinalRange, s::OrdinalRange) =
611611
(first(r) == first(s)) & (step(r) == step(s)) & (last(r) == last(s))
612-
==(r::T, s::T) where {T<:Union{StepRangeLen,LinSpace}} =
612+
==(r::T, s::T) where {T<:Union{StepRangeLen,LinRange}} =
613613
(first(r) == first(s)) & (length(r) == length(s)) & (last(r) == last(s))
614614
==(r::Union{StepRange{T},StepRangeLen{T,T}}, s::Union{StepRange{T},StepRangeLen{T,T}}) where {T} =
615615
(first(r) == first(s)) & (last(r) == last(s)) & (step(r) == step(s))
@@ -747,32 +747,32 @@ end
747747
-(r::OrdinalRange) = range(-first(r), step=-step(r), length=length(r))
748748
-(r::StepRangeLen{T,R,S}) where {T,R,S} =
749749
StepRangeLen{T,R,S}(-r.ref, -r.step, length(r), r.offset)
750-
-(r::LinSpace) = LinSpace(-r.start, -r.stop, length(r))
750+
-(r::LinRange) = LinRange(-r.start, -r.stop, length(r))
751751

752752
*(x::Number, r::AbstractRange) = range(x*first(r), step=x*step(r), length=length(r))
753753
*(x::Number, r::StepRangeLen{T}) where {T} =
754754
StepRangeLen{typeof(x*T(r.ref))}(x*r.ref, x*r.step, length(r), r.offset)
755-
*(x::Number, r::LinSpace) = LinSpace(x * r.start, x * r.stop, r.len)
755+
*(x::Number, r::LinRange) = LinRange(x * r.start, x * r.stop, r.len)
756756
# separate in case of noncommutative multiplication
757757
*(r::AbstractRange, x::Number) = range(first(r)*x, step=step(r)*x, length=length(r))
758758
*(r::StepRangeLen{T}, x::Number) where {T} =
759759
StepRangeLen{typeof(T(r.ref)*x)}(r.ref*x, r.step*x, length(r), r.offset)
760-
*(r::LinSpace, x::Number) = LinSpace(r.start * x, r.stop * x, r.len)
760+
*(r::LinRange, x::Number) = LinRange(r.start * x, r.stop * x, r.len)
761761

762762
/(r::AbstractRange, x::Number) = range(first(r)/x, step=step(r)/x, length=length(r))
763763
/(r::StepRangeLen{T}, x::Number) where {T} =
764764
StepRangeLen{typeof(T(r.ref)/x)}(r.ref/x, r.step/x, length(r), r.offset)
765-
/(r::LinSpace, x::Number) = LinSpace(r.start / x, r.stop / x, r.len)
765+
/(r::LinRange, x::Number) = LinRange(r.start / x, r.stop / x, r.len)
766766
# also, separate in case of noncommutative multiplication (division)
767767
\(x::Number, r::AbstractRange) = range(x\first(r), step=x\step(r), length=x\length(r))
768768
\(x::Number, r::StepRangeLen) = StepRangeLen(x\r.ref, x\r.step, length(r), r.offset)
769-
\(x::Number, r::LinSpace) = LinSpace(x \ r.start, x \ r.stop, r.len)
769+
\(x::Number, r::LinRange) = LinRange(x \ r.start, x \ r.stop, r.len)
770770

771771
## scalar-range broadcast operations ##
772772

773773
broadcast(::typeof(-), r::OrdinalRange) = range(-first(r), step=-step(r), length=length(r))
774774
broadcast(::typeof(-), r::StepRangeLen) = StepRangeLen(-r.ref, -r.step, length(r), r.offset)
775-
broadcast(::typeof(-), r::LinSpace) = LinSpace(-r.start, -r.stop, length(r))
775+
broadcast(::typeof(-), r::LinRange) = LinRange(-r.start, -r.stop, length(r))
776776

777777
broadcast(::typeof(+), x::Real, r::AbstractUnitRange) = range(x + first(r), length=length(r))
778778
# For #18336 we need to prevent promotion of the step type:
@@ -782,34 +782,34 @@ function broadcast(::typeof(+), x::Number, r::StepRangeLen{T}) where T
782782
newref = x + r.ref
783783
StepRangeLen{typeof(T(r.ref) + x)}(newref, r.step, length(r), r.offset)
784784
end
785-
function broadcast(::typeof(+), x::Number, r::LinSpace)
786-
LinSpace(x + r.start, x + r.stop, r.len)
785+
function broadcast(::typeof(+), x::Number, r::LinRange)
786+
LinRange(x + r.start, x + r.stop, r.len)
787787
end
788788
broadcast(::typeof(+), r::AbstractRange, x::Number) = broadcast(+, x, r) # assumes addition is commutative
789789

790790
broadcast(::typeof(-), x::Number, r::AbstractRange) = (x-first(r)):-step(r):(x-last(r))
791791
broadcast(::typeof(-), x::Number, r::StepRangeLen) = broadcast(+, x, -r)
792-
function broadcast(::typeof(-), x::Number, r::LinSpace)
793-
LinSpace(x - r.start, x - r.stop, r.len)
792+
function broadcast(::typeof(-), x::Number, r::LinRange)
793+
LinRange(x - r.start, x - r.stop, r.len)
794794
end
795795

796796
broadcast(::typeof(-), r::AbstractRange, x::Number) = broadcast(+, -x, r) # assumes addition is commutative
797797

798798
broadcast(::typeof(*), x::Number, r::AbstractRange) = range(x*first(r), step=x*step(r), length=length(r))
799799
broadcast(::typeof(*), x::Number, r::StepRangeLen) = StepRangeLen(x*r.ref, x*r.step, length(r), r.offset)
800-
broadcast(::typeof(*), x::Number, r::LinSpace) = LinSpace(x * r.start, x * r.stop, r.len)
800+
broadcast(::typeof(*), x::Number, r::LinRange) = LinRange(x * r.start, x * r.stop, r.len)
801801
# separate in case of noncommutative multiplication
802802
broadcast(::typeof(*), r::AbstractRange, x::Number) = range(first(r)*x, step=step(r)*x, length=length(r))
803803
broadcast(::typeof(*), r::StepRangeLen, x::Number) = StepRangeLen(r.ref*x, r.step*x, length(r), r.offset)
804-
broadcast(::typeof(*), r::LinSpace, x::Number) = LinSpace(r.start * x, r.stop * x, r.len)
804+
broadcast(::typeof(*), r::LinRange, x::Number) = LinRange(r.start * x, r.stop * x, r.len)
805805

806806
broadcast(::typeof(/), r::AbstractRange, x::Number) = range(first(r)/x, step=step(r)/x, length=length(r))
807807
broadcast(::typeof(/), r::StepRangeLen, x::Number) = StepRangeLen(r.ref/x, r.step/x, length(r), r.offset)
808-
broadcast(::typeof(/), r::LinSpace, x::Number) = LinSpace(r.start / x, r.stop / x, r.len)
808+
broadcast(::typeof(/), r::LinRange, x::Number) = LinRange(r.start / x, r.stop / x, r.len)
809809
# also, separate in case of noncommutative multiplication (division)
810810
broadcast(::typeof(\), x::Number, r::AbstractRange) = range(x\first(r), step=x\step(r), length=x\length(r))
811811
broadcast(::typeof(\), x::Number, r::StepRangeLen) = StepRangeLen(x\r.ref, x\r.step, length(r), r.offset)
812-
broadcast(::typeof(\), x::Number, r::LinSpace) = LinSpace(x \ r.start, x \ r.stop, r.len)
812+
broadcast(::typeof(\), x::Number, r::LinRange) = LinRange(x \ r.start, x \ r.stop, r.len)
813813

814814
# promote eltype if at least one container wouldn't change, otherwise join container types.
815815
el_same(::Type{T}, a::Type{<:AbstractArray{T,n}}, b::Type{<:AbstractArray{T,n}}) where {T,n} = a
@@ -869,16 +869,16 @@ StepRangeLen{T}(r::AbstractRange) where {T} =
869869
StepRangeLen(T(first(r)), T(step(r)), length(r))
870870
StepRangeLen(r::AbstractRange) = StepRangeLen{eltype(r)}(r)
871871

872-
promote_rule(a::Type{LinSpace{T1}}, b::Type{LinSpace{T2}}) where {T1,T2} =
872+
promote_rule(a::Type{LinRange{T1}}, b::Type{LinRange{T2}}) where {T1,T2} =
873873
el_same(promote_type(T1,T2), a, b)
874-
LinSpace{T}(r::LinSpace{T}) where {T} = r
875-
LinSpace{T}(r::AbstractRange) where {T} = LinSpace{T}(first(r), last(r), length(r))
876-
LinSpace(r::AbstractRange{T}) where {T} = LinSpace{T}(r)
874+
LinRange{T}(r::LinRange{T}) where {T} = r
875+
LinRange{T}(r::AbstractRange) where {T} = LinRange{T}(first(r), last(r), length(r))
876+
LinRange(r::AbstractRange{T}) where {T} = LinRange{T}(r)
877877

878-
promote_rule(a::Type{LinSpace{T}}, ::Type{OR}) where {T,OR<:OrdinalRange} =
879-
promote_rule(a, LinSpace{eltype(OR)})
878+
promote_rule(a::Type{LinRange{T}}, ::Type{OR}) where {T,OR<:OrdinalRange} =
879+
promote_rule(a, LinRange{eltype(OR)})
880880

881-
promote_rule(::Type{LinSpace{L}}, b::Type{StepRangeLen{T,R,S}}) where {L,T,R,S} =
881+
promote_rule(::Type{LinRange{L}}, b::Type{StepRangeLen{T,R,S}}) where {L,T,R,S} =
882882
promote_rule(StepRangeLen{L,L,L}, b)
883883

884884
# +/- of ranges is defined in operators.jl (to be able to use @eval etc.)
@@ -904,7 +904,7 @@ collect(r::AbstractRange) = vcat(r)
904904

905905
reverse(r::OrdinalRange) = colon(last(r), -step(r), first(r))
906906
reverse(r::StepRangeLen) = StepRangeLen(r.ref, -r.step, length(r), length(r)-r.offset+1)
907-
reverse(r::LinSpace) = LinSpace(r.stop, r.start, length(r))
907+
reverse(r::LinRange) = LinRange(r.stop, r.start, length(r))
908908

909909
## sorting ##
910910

@@ -966,16 +966,16 @@ function _define_range_op(@nospecialize f)
966966
range($f(first(r1), first(r2)), step=$f(step(r1), step(r2)), length=r1l)
967967
end
968968

969-
function $f(r1::LinSpace{T}, r2::LinSpace{T}) where T
969+
function $f(r1::LinRange{T}, r2::LinRange{T}) where T
970970
len = r1.len
971971
(len == r2.len ||
972972
throw(DimensionMismatch("argument dimensions must match")))
973-
LinSpace{T}(convert(T, $f(first(r1), first(r2))),
973+
LinRange{T}(convert(T, $f(first(r1), first(r2))),
974974
convert(T, $f(last(r1), last(r2))), len)
975975
end
976976

977-
$f(r1::Union{StepRangeLen, OrdinalRange, LinSpace},
978-
r2::Union{StepRangeLen, OrdinalRange, LinSpace}) =
977+
$f(r1::Union{StepRangeLen, OrdinalRange, LinRange},
978+
r2::Union{StepRangeLen, OrdinalRange, LinRange}) =
979979
$f(promote(r1, r2)...)
980980
end
981981
end

base/show.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
show(io::IO, ::MIME"text/plain", r::AbstractRange) = show(io, r) # always use the compact form for printing ranges
66

7-
function show(io::IO, ::MIME"text/plain", r::LinSpace)
8-
# show for LinSpace, e.g.
7+
function show(io::IO, ::MIME"text/plain", r::LinRange)
8+
# show for LinRange, e.g.
99
# range(1, stop=3, length=7)
10-
# 7-element LinSpace{Float64}:
10+
# 7-element LinRange{Float64}:
1111
# 1.0,1.33333,1.66667,2.0,2.33333,2.66667,3.0
1212
print(io, summary(r))
1313
if !isempty(r)

base/twiceprecision.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ function +(r1::StepRangeLen{T,R}, r2::StepRangeLen{T,R}) where T where R<:TwiceP
567567
StepRangeLen{T,typeof(ref),typeof(step)}(ref, step, len, imid)
568568
end
569569

570-
## LinSpace
570+
## LinRange
571571

572572
# For Float16, Float32, and Float64, this returns a StepRangeLen
573573
function _range(start::T, ::Nothing, stop::T, len::Integer) where {T<:IEEEFloat}

stdlib/LinearAlgebra/test/generic.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ end
119119
@test [linreg(x,y)...] [2.5559090909090867, 1.6960139860139862]
120120
@test [linreg(view(x,1:6),view(y,1:6))...] [3.8366666666666642,1.3271428571428574]
121121

122-
# check (LinSpace, UnitRange)
122+
# check (LinRange, UnitRange)
123123
x = range(1.0, stop=12.0, length=100)
124124
y = -100:-1
125125
@test [linreg(x, y)...] [-109.0, 9.0]
@@ -129,7 +129,7 @@ end
129129
y = 12:-1:1
130130
@test [linreg(x, y)...] [13.0, -1.0]
131131

132-
# check (LinSpace, LinSpace)
132+
# check (LinRange, LinRange)
133133
x = range(-5, stop=10, length=100)
134134
y = range(50, stop=200, length=100)
135135
@test [linreg(x, y)...] [100.0, 10.0]

0 commit comments

Comments
 (0)