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

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

Closed
mtenders opened this issue Sep 21, 2022 · 4 comments
Closed

Comments

@mtenders
Copy link

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?

mtenders added a commit to mtenders/GeneralizedTransferMatrixMethod.jl that referenced this issue Sep 21, 2022
@mkitti
Copy link
Collaborator

mkitti commented Sep 21, 2022

Huh... I'll investigate.

Do I understand correctly that the issue does not occur with Julia 1.7 even if you load Interpolations.jl?

If you have some time, could you try an earlier version of Interpolations.jl to bisect the issue?

@mtenders
Copy link
Author

Yes, it does not occur when I load Interpolations.jl in Julia 1.7.

I tried around a bit and I don't get any errors going back to v0.13.3.

Going back to v0.13.3 also downgrades some of the dependencies. They don't get updated automatically going from v0.13.3 to v0.13.4. I only get the error when I upgrade the dependencies to their newest version (see below), after going to v0.13.4.

  [d360d2e6] ↑ ChainRulesCore v0.10.13 ⇒ v1.15.5
  [9e997f8a] + ChangesOfVariables v0.1.4
  [34da2185] ↑ Compat v3.46.0 ⇒ v4.2.0
  [ffbed154] ↑ DocStringExtensions v0.8.6 ⇒ v0.9.1
  [3587e190] + InverseFunctions v0.1.7
  [2ab3a3ac] ↑ LogExpFunctions v0.3.0 ⇒ v0.3.18
  [276daf66] ↑ SpecialFunctions v2.1.3 ⇒ v2.1.7

The problem seems to come from ChainRulesCore.jl. I get the same error, when I just load ChainRulesCore.jl instead of Interpolations.jl.

I filed an issue with them (JuliaDiff/ChainRulesCore.jl/issues/588).

@longemen3000
Copy link

this problem seems solved?

@mkitti mkitti closed this as completed May 20, 2023
@mkitti
Copy link
Collaborator

mkitti commented May 20, 2023

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

No branches or pull requests

3 participants