From f352518968f663ca4e8116f6aae0eb45943f6cef Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Fri, 9 Jun 2023 14:16:01 +0200 Subject: [PATCH] forgot signature + add tests --- src/Loess.jl | 2 +- test/runtests.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Loess.jl b/src/Loess.jl index d78e97d..e882e3b 100644 --- a/src/Loess.jl +++ b/src/Loess.jl @@ -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} = diff --git a/test/runtests.jl b/test/runtests.jl index 55967fa..7274e3e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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)