Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array{Missing} breaks matrix multiplication in some cases #39362

Closed
henriquebecker91 opened this issue Jan 22, 2021 · 1 comment · Fixed by #39790
Closed

Array{Missing} breaks matrix multiplication in some cases #39362

henriquebecker91 opened this issue Jan 22, 2021 · 1 comment · Fixed by #39790
Labels
missing data Base.missing and related functionality

Comments

@henriquebecker91
Copy link
Contributor

Based on this discourse thread.

In Julia 1.5.3:

julia> omega = randn(10,10)
10×10 Array{Float64,2}:
...
julia> a = Array{Missing}(missing, 10, 1)
10×1 Array{Missing,2}:
...
julia> result = a' * omega * a
ERROR: InexactError: trunc(Int64, Inf)
Stacktrace:
...
julia> result =  (omega * a)
10×1 Array{Missing,2}:
...
julia> result =  (a' * omega)
1×10 Array{Missing,2}:
...
julia> a = Array{Union{Missing, Float64}}(missing, 10, 1)
10×1 Array{Union{Missing, Float64},2}:
...
julia> result = a' * omega * a
1×1 Array{Union{Missing, Float64},2}:
 missing

Not sure of a bug or using Array{Missing, 2} is something to be avoided, but it seems inconsistent that it works on some cases and not in others. If Array{Union{Missing, Float64}} is used it always seem to work.

@simeonschaub
Copy link
Member

simeonschaub commented Jan 22, 2021

No, this should definitely work. Just looks like our generic matmul currently assumes one of the element types is not of size zero, which fails if you multiply two arrays of missing:

tile_size = floor(Int, sqrt(tilebufsize / max(sizeof(R), sizeof(S), sizeof(T))))
Probably easy enough to fix though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing data Base.missing and related functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants