gdkrmr
January 23, 2019, 9:56am
1
The first one seems intended behaviour, is the second one a bug?
julia> rand(3, 3) * [1.0, missing, missing]
3-element Array{Union{Missing, Float64},1}:
missing
missing
missing
julia> rand(3, 3) * [1.0f0, missing, missing]
3-element Array{Any,1}:
missing
missing
missing
I would expect the second one to have elements of type Union{Missing, Float64}
.
julia> rand(3, 3) * [1.0f0, 1.0f0, 1.0f0]
3-element Array{Float64,1}:
0.905265774575643
1.93440074935859
1.3997240853999218
Raf
January 23, 2019, 12:43pm
2
Rand by default is Float64. Using Float32 gets what you want:
julia> rand(Float32, 3, 3) * [1.0f0, missing, missing]
3-element Array{Union{Missing, Float32},1}:
missing
missing
missing
Although I’m not sure why that results in Any
when you multiply Float32 and Float64.
Edit: seems like any combination of two numbers and missing in an array multiplication gives any.
julia> [2, 3] * [1.0 missing]
2Ă—2 Array{Any,2}:
2.0 missing
3.0 missing
gdkrmr
January 23, 2019, 1:07pm
3
This seems odd, especially because
julia> promote_type(Union{Missing, Float32}, Union{Missing, Float64})
Union{Missing, Float64}
Raf
January 23, 2019, 1:08pm
4
Especially when:
julia> [2, 3] .* [1.0 missing]
2Ă—2 Array{Union{Missing, Float64},2}:
2.0 missing
3.0 missing
Edit: with float not all ints!
The bug appears to have been fixed on master, please check with 1.1.
2 Likes
gdkrmr
January 23, 2019, 1:25pm
6
Yes, is fixed in Julia 1.1, is there going to be a fix for 1.0?
gdkrmr
January 23, 2019, 5:34pm
8
Isn’t 1.0 supposed to be a long term support version?
Yes, but changing return types can break someones code.
Note that there is no commitment to backporting every bug fix (see the “Long term support” part):
Now that we’ve released Julia 1.0 and are close to 1.0.1 and have added some new features and minor changes to the 1.1 development branch (i.e. master), it seems like time to talk about the future of the Julia release process. After various discussions in person, on Slack, and on this week’s triage call, it seems like there’s fairly solid consensus behind the following plan.
Patch releases
Patch releases increment the last digit of Julia’s version number, e.g. going from 1.0.0 to 1.0.1 curre…
gdkrmr
January 24, 2019, 9:12am
11
For my usecase, I fixed it with
y = mul!(similar(x), A, x)
this is not generalizable, but works for my use case.
1 Like