Skip to content

Loading Interpolations.jl breaks complex number arithmetic on Julia 1.8.1 #520

Closed
@mtenders

Description

@mtenders

Hi,

I'm running Interpolations.jl with Julia 1.8.1. I get an error when I run the following (supposedly) simple code:

julia> using Interpolations

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
ERROR: - not defined for Complex{Int64}
Stacktrace:
 [1] error(::String, ::String, ::Type)
   @ Base ./error.jl:44
 [2] no_op_err(name::String, T::Type)
   @ Base ./promotion.jl:462
 [3] -(x::Complex{Int64}, y::Complex{Int64})
   @ Base ./promotion.jl:465
 [4] _broadcast_getindex_evalf
   @ ./broadcast.jl:670 [inlined]
 [5] _broadcast_getindex
   @ ./broadcast.jl:643 [inlined]
 [6] getindex
   @ ./broadcast.jl:597 [inlined]
 [7] copy
   @ ./broadcast.jl:899 [inlined]
 [8] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Vector{Complex}, Vector{Complex{Int64}}}}, Vector{Complex{Int64}}}})
   @ Base.Broadcast ./broadcast.jl:860
 [9] top-level scope
   @ REPL[4]:1

I tested the same example with Julia 1.7.2 and it seemed to work just fine. Also the following examples don't give me any erros:

julia> a .* b - b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

julia> a .- b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

Everything works normally if I don't load Interpolations in the beginning. Do you have any idea where this is coming from?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions