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

testvalue stackoverflows when called on LKJCholesky #134

Closed
sethaxen opened this issue Aug 11, 2021 · 3 comments · Fixed by #137
Closed

testvalue stackoverflows when called on LKJCholesky #134

sethaxen opened this issue Aug 11, 2021 · 3 comments · Fixed by #137
Assignees

Comments

@sethaxen
Copy link
Collaborator

Currently this happens.

julia> testvalue(LKJCholesky(10, 2.0))
ERROR: StackOverflowError:
Stacktrace:
 [1] testvalue::Lebesgue{()}) (repeats 79984 times)
   @ MeasureTheory ~/.julia/packages/MeasureTheory/cKsEt/src/utils.jl:38

This causes any Soss models that use LKJCholesky to fail.

@sethaxen
Copy link
Collaborator Author

It seems this is due to at least two separate issues. First, testvalue is not implemented for several primitive measures, but when the default implementation hits a primitive measure, it stackoverflows. Second, we have this:

julia> d = Lebesgue(ℝ)^5
For(Lebesgue, Fill((), 5))

julia> marginals(d)
5-element mappedarray(Lebesgue, ::FillArrays.Fill{Tuple{}, 1, Tuple{Base.OneTo{Int64}}}) with eltype Lebesgue:
 Lebesgue(())
 Lebesgue(())
 Lebesgue(())
 Lebesgue(())
 Lebesgue(())

I'm guessing each marginal should be a Lebesgue(ℝ)? Because the default implementation of testvalue maps over the marginals, it won't know what to do when it hits a Lebesgue(()).

@cscherrer
Copy link
Collaborator

Thanks @sethaxen ! Yes, this is a bug.

@cscherrer cscherrer self-assigned this Aug 13, 2021
@cscherrer cscherrer linked a pull request Aug 14, 2021 that will close this issue
@cscherrer
Copy link
Collaborator

In the testvalues branch,

julia> using MeasureTheory

julia> testvalue(LKJCholesky(10, 2.0))
LinearAlgebra.Cholesky{Float64, LinearAlgebra.UpperTriangular{Float64, Matrix{Float64}}}
U factor:
10×10 LinearAlgebra.UpperTriangular{Float64, Matrix{Float64}}:
 1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
     1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
         1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
             1.0  0.0  0.0  0.0  0.0  0.0  0.0
                 1.0  0.0  0.0  0.0  0.0  0.0
                     1.0  0.0  0.0  0.0  0.0
                         1.0  0.0  0.0  0.0
                             1.0  0.0  0.0
                                 1.0  0.0
                                     1.0

I've linked that PR so merging will close this

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