Skip to content

Commit

Permalink
enforce type consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed Jul 25, 2023
1 parent fe24993 commit 5be74de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/robustlinearmodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ function StatsAPI.fit(
f, y, X, extra = modelframe(f, data, contrasts, dropmissing, M; wts=wts)
# Call the `fit` method with arrays
pX, py = promote_to_same_float(X, y)
return fit(M, pX, py, args...; wts=extra.wts, contrasts=contrasts, __formula=f, kwargs...)
return fit(
M, pX, py, args...; wts=extra.wts, contrasts=contrasts, __formula=f, kwargs...
)
end


Expand Down
5 changes: 1 addition & 4 deletions src/tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
## Missing values
################################################

function promote_to_same_float(
X::AbstractMatrix,
y::AbstractVector,
)
function promote_to_same_float(X::AbstractMatrix, y::AbstractVector)
T = promote_type(float(eltype(X)), float(eltype(y)))
if !(T <: AbstractFloat)
msg = "promoting X and y arrays to float types"
Expand Down

0 comments on commit 5be74de

Please sign in to comment.