GLM.jl
GLM.jl copied to clipboard
convert all eltypes of GlmResp args to the eltype of the first
min example: GLM.GlmResp(randn(10), Binomial(), LogitLink(), randn(Float32, 10), randn(10))
Gets stuck in a loop because float
won't convert Float64
and Float32
to the same type. I just turned the first one into a float, and then made the rest match that type of float explicitly.
digging a bit further, it seems the problem I was trying to address with this was actually caused in Lasso.jl, which was inconsistent about handing Float32
and Float64
to GLM.jl. I think this pull is still worth changing, but there are several changes elsewhere that are also needed if the input is somewhat inconsistent about the type of float involved.
Thanks. Though note that float
only makes a copy when necessary, contrary to what would happen with this PR. Can you change it to use convert
instead? Also better use promote_type
to choose the appropriate destination type.