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

Since v0.5.0 I get the following error: ERROR: MethodError: no method matching isless(::Type{Any}, ::Type{Any}) #185

Closed
zsoerenm opened this issue Apr 19, 2021 · 1 comment

Comments

@zsoerenm
Copy link

zsoerenm commented Apr 19, 2021

Since v0.5.0 I get the following error when I try to broadcast multiply a regular matrix with a Structarray vector and save the result in a StructArray matrix:

A = StructArray(randn(ComplexF64, 3, 3))
B = randn(ComplexF64, 3, 3)
c = StructArray(randn(ComplexF64, 3))
A .= B .* c
ERROR: MethodError: no method matching isless(::Type{Any}, ::Type{Any})
Closest candidates are:
  isless(::Any, ::Missing) at missing.jl:88
  isless(::Missing, ::Any) at missing.jl:87
Stacktrace:
 [1] max(x::Type, y::Type)
   @ Base ./operators.jl:419
 [2] Base.Broadcast.BroadcastStyle(a::StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{2}}, b::StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{1}})
   @ Base.Broadcast ./broadcast.jl:142
 [3] result_style(s1::StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{2}}, s2::StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{1}})
   @ Base.Broadcast ./broadcast.jl:445
 [4] combine_styles(c1::StructArray{ComplexF64, 2, NamedTuple{(:re, :im), Tuple{Matrix{Float64}, Matrix{Float64}}}, Int64}, c2::Base.Broadcast.Broadcasted{StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{1}}, Nothing, typeof(*), Tuple{Matrix{ComplexF64}, StructVector{ComplexF64, NamedTuple{(:re, :im), Tuple{Vector{Float64}, Vector{Float64}}}, Int64}}})
   @ Base.Broadcast ./broadcast.jl:421
 [5] materialize!(dest::StructArray{ComplexF64, 2, NamedTuple{(:re, :im), Tuple{Matrix{Float64}, Matrix{Float64}}}, Int64}, bc::Base.Broadcast.Broadcasted{StructArrays.StructArrayStyle{Base.Broadcast.DefaultArrayStyle{1}}, Nothing, typeof(*), Tuple{Matrix{ComplexF64}, StructVector{ComplexF64, NamedTuple{(:re, :im), Tuple{Vector{Float64}, Vector{Float64}}}, Int64}}})
   @ Base.Broadcast ./broadcast.jl:891

This works fine for StructArrays < v0.5.0

@zsoerenm zsoerenm changed the title Since v0.5.0 I get the following error: Since v0.5.0 I get the following error: ERROR: MethodError: no method matching isless(::Type{Any}, ::Type{Any}) Apr 19, 2021
@piever
Copy link
Collaborator

piever commented Apr 19, 2021

Now StructArrays has a custom broadcast implementation (for instance B .* c is now a StructArray), which seems to have introduced this bug.

Even with all StructArrays, it still doesn't work, it seems related to extending singleton dimensions. For example the following also errors:

A = StructArray(randn(ComplexF64, 3, 3))
B = StructArray(randn(ComplexF64, 3, 3))
c = StructArray(randn(ComplexF64, 3))
A .= B .* c

CC @timholy

N5N3 added a commit to N5N3/StructArrays.jl that referenced this issue Feb 9, 2022
N5N3 added a commit to N5N3/StructArrays.jl that referenced this issue Feb 12, 2022
commit 3c4b7f2
Author: N5N3 <2642243996@qq.com>
Date:   Thu Feb 10 13:46:50 2022 +0800

    Fix regression on `StaticArray`

    Make sure `StructArrayStyle{<:StaticArrayStyle}` lose to `DefaultArrayStyle`

commit c7a4dc8
Author: N5N3 <2642243996@qq.com>
Date:   Thu Feb 10 12:43:46 2022 +0800

    Try to resolve style conflict and extend `similar`

commit 9b9d8b2
Author: N5N3 <2642243996@qq.com>
Date:   Wed Feb 9 22:18:52 2022 +0800

    Make `StructArrayStyle` track inputs dimension

    fix JuliaArrays#185
N5N3 added a commit to N5N3/StructArrays.jl that referenced this issue Feb 20, 2022
@piever piever closed this as completed in 2bd33e3 Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants