Skip to content

Commit

Permalink
Merge pull request #70 from SimonDanisch/master
Browse files Browse the repository at this point in the history
fix calls to constructor
  • Loading branch information
andreasnoack committed Jun 9, 2023
2 parents 9fd7d9d + f352518 commit c4b4e4f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Loess.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function loess(
]
end

LoessModel(xs, ys, predictions_and_gradients, kdtree)
LoessModel(convert(Matrix{T}, xs), convert(Vector{T}, ys), predictions_and_gradients, kdtree)
end

loess(xs::AbstractVector{T}, ys::AbstractVector{T}; kwargs...) where {T<:AbstractFloat} =
Expand Down
3 changes: 1 addition & 2 deletions src/kd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function KDTree(

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

KDTree(xs, collect(1:n), root, verts, bounds)
KDTree(convert(Matrix{T}, xs), collect(1:n), root, verts, bounds)
end


Expand Down Expand Up @@ -276,4 +276,3 @@ function _traverse!(bounds, node::KDNode, x)
return _traverse!(bounds, node.rightnode, x)
end
end

6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ using RDatasets
@test Loess.predict(model,x) y
end

@testset "reshaped views" begin
# See: https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/462
# and: https://github.com/JuliaStats/Loess.jl/pull/70
@test Loess.loess(reshape(view(rand(4), 1:4), (4, 1)), rand(4)) isa Loess.LoessModel
end

@testset "sine" begin
x = 1:10
y = sin.(1:10)
Expand Down

0 comments on commit c4b4e4f

Please sign in to comment.