Skip to content

log_likelihood in kalman.jl failing with nightly (1.14.0-DEV.68) #369

Description

@oyamad

QuantEcon.jl/src/kalman.jl

Lines 208 to 213 in 43e3634

function log_likelihood(k::Kalman, y::AbstractVector)
eta = y - k.G*k.cur_x_hat # forecast error
P = k.G*k.cur_sigma*k.G' + k.R # covariance matrix of forecast error
logL = - (length(y)*log(2pi) + logdet(P) .+ eta'/P*eta)[1]/2
return logL
end

Error message
Testing kalman.jl: Error During Test at /home/runner/work/QuantEcon.jl/QuantEcon.jl/test/test_kalman.jl:1
  Got exception outside of a @test
  MethodError: no method matching det(::Vector{Float64})
  The function `det` exists, but no method is defined for this combination of argument types.
  Closest candidates are:
    det(::SparseArrays.UMFPACK.UmfpackLU{Float64, Int32})
     @ SparseArrays /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.14/SparseArrays/src/solvers/umfpack.jl:693
    det(::SparseArrays.UMFPACK.UmfpackLU{ComplexF64, Int32})
     @ SparseArrays /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.14/SparseArrays/src/solvers/umfpack.jl:699
    det(::SparseArrays.UMFPACK.UmfpackLU{Float64, Int64})
     @ SparseArrays /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.14/SparseArrays/src/solvers/umfpack.jl:693
    ...
  Stacktrace:
    [1] logdet(A::Vector{Float64})
      @ LinearAlgebra /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.14/LinearAlgebra/src/generic.jl:1911
    [2] log_likelihood(k::Kalman, y::Vector{Float64})
      @ QuantEcon ~/work/QuantEcon.jl/QuantEcon.jl/src/kalman.jl:211
    [3] smooth(kn::Kalman, y::Matrix{Float64})
      @ QuantEcon ~/work/QuantEcon.jl/QuantEcon.jl/src/kalman.jl:274
    [4] top-level scope
      @ ~/work/QuantEcon.jl/QuantEcon.jl/test/test_kalman.jl:4
    [5] macro expansion
      @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.14/Test/src/Test.jl:1961 [inlined]
    [6] macro expansion
      @ ~/work/QuantEcon.jl/QuantEcon.jl/test/test_kalman.jl:89 [inlined]
    [7] include(mapexpr::Function, mod::Module, _path::String)
      @ Base ./Base.jl:310
    [8] top-level scope
      @ ~/work/QuantEcon.jl/QuantEcon.jl/test/runtests.jl:54
    [9] include(mapexpr::Function, mod::Module, _path::String)
      @ Base ./Base.jl:310
   [10] top-level scope
      @ none:6
   [11] eval(m::Module, e::Any)
      @ Core ./boot.jl:489
   [12] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:310
   [13] _start()
      @ Base ./client.jl:577
Test Summary:     | Pass  Error  Total  Time
Testing kalman.jl |    9      1     10  9.5s
RNG of the outermost testset: Xoshiro(0xa379de7eeeb2a4e8, 0x953dccb6b532b3af, 0xf597b8ff8cfd652a, 0xccd7337c571680d1, 0xc90c4a0730db3f7e)
ERROR: LoadError: Some tests did not pass: 9 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /home/runner/work/QuantEcon.jl/QuantEcon.jl/test/test_kalman.jl:1
in expression starting at /home/runner/work/QuantEcon.jl/QuantEcon.jl/test/runtests.jl:51
Package QuantEcon errored during testing
Error: Process completed with exit code 1.

On nightly, it seems that P = k.G*k.cur_sigma*k.G' + k.R is computed as a Vector, which we want to be a 1x1 Matrix (or a Number).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions