Giter VIP home page Giter VIP logo

Comments (1)

Seelengrab avatar Seelengrab commented on June 24, 2024

There's definitely some erroring paths in log. I wasn't able to produce the errors from your investigation with JET, but I was able to produce this one:

julia> using LinearAlgebra

julia> [NaN 0.0; 0.0 0.0] |> UpperTriangular
2×2 UpperTriangular{Float64, Matrix{Float64}}:
 NaN    0.0
       0.0

julia> [NaN 0.0; 0.0 0.0] |> UpperTriangular |> log
ERROR: InexactError: Float64(NaN + NaN*im)
Stacktrace:
  [1] Real
    @ ./complex.jl:44 [inlined]
  [2] convert
    @ ./number.jl:7 [inlined]
  [3] setindex!
    @ ./array.jl:979 [inlined]
  [4] setindex!
    @ ~/julia/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/triangular.jl:286 [inlined]
  [5] _pow_superdiag_quasitriu!(A::UpperTriangular{Float64, Matrix{…}}, A0::UpperTriangular{Float64, Matrix{…}}, p::Float64)
    @ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/triangular.jl:2088
  [6] _log_quasitriu!(A0::UpperTriangular{Float64, Matrix{Float64}}, A::UpperTriangular{Float64, Matrix{Float64}})
    @ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/triangular.jl:1816
  [7] log_quasitriu(A0::UpperTriangular{Float64, Matrix{Float64}})
    @ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/triangular.jl:1798
  [8] log
    @ ~/julia/usr/share/julia/stdlib/v1.12/LinearAlgebra/src/triangular.jl:1779 [inlined]
  [9] |>(x::UpperTriangular{Float64, Matrix{Float64}}, f::typeof(log))
    @ Base ./operators.jl:967
 [10] top-level scope
    @ REPL[38]:1
Some type information was truncated. Use `show(err)` to see complete types.

Being unfamiliar with the math involved here and the docs not mentioning anything about NaN in the input matrix, I have no idea whether that is intended though :/ At the very least, it's a hard-to-diagnose/reconcile error.

Here's the fuzzing setup that found this:

julia> using Supposition, LinearAlgebra

julia> square_mats = Data.SquareMatrices(Data.Floats{Float64}(); max_size=20) # upcoming Possibility in the next release
Supposition.Data.SquareMatrices(Supposition.Data.Vectors(Supposition.Data.Floats{Float64}(; nans=true, infs=true); min_size=0, max_size=400); min_size=0, max_size=20)

julia> mats = map(UpperTriangular, square_mats);

julia> @check db=false (m=mats) -> log(m) isa UpperTriangular
Encountered an error
  Context: ##SuppositionAnon#646

  Arguments:
      m::UpperTriangular{Float64, Matrix{Float64}} = [NaN 0.0; 0.0 0.0]

  Exception:
    Message:
      InexactError: Float64(NaN + NaN*im)

If I catch that InexactError, the test passes even when I crank it up to 1_000_000 examples. The same goes for disabling NaN in the generation of data.

from julia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.