Skip to content

Commit c4b4e4f

Browse files
authored
Merge pull request #70 from SimonDanisch/master
fix calls to constructor
2 parents 9fd7d9d + f352518 commit c4b4e4f

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/Loess.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function loess(
136136
]
137137
end
138138

139-
LoessModel(xs, ys, predictions_and_gradients, kdtree)
139+
LoessModel(convert(Matrix{T}, xs), convert(Vector{T}, ys), predictions_and_gradients, kdtree)
140140
end
141141

142142
loess(xs::AbstractVector{T}, ys::AbstractVector{T}; kwargs...) where {T<:AbstractFloat} =

src/kd.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function KDTree(
6565

6666
root = build_kdtree(xs, perm, bounds, leaf_size_cutoff, leaf_diameter_cutoff, verts)
6767

68-
KDTree(xs, collect(1:n), root, verts, bounds)
68+
KDTree(convert(Matrix{T}, xs), collect(1:n), root, verts, bounds)
6969
end
7070

7171

@@ -276,4 +276,3 @@ function _traverse!(bounds, node::KDNode, x)
276276
return _traverse!(bounds, node.rightnode, x)
277277
end
278278
end
279-

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ using RDatasets
2525
@test Loess.predict(model,x) y
2626
end
2727

28+
@testset "reshaped views" begin
29+
# See: https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/462
30+
# and: https://github.com/JuliaStats/Loess.jl/pull/70
31+
@test Loess.loess(reshape(view(rand(4), 1:4), (4, 1)), rand(4)) isa Loess.LoessModel
32+
end
33+
2834
@testset "sine" begin
2935
x = 1:10
3036
y = sin.(1:10)

0 commit comments

Comments
 (0)