JuliaApproximation / JuliaApproximation/ApproxFun.jl
Evaluating at endpoints of open interval
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 559
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
The code seems to be creating errors by trying to evaluate at endpoints of an open interval, when the function might not exist at these endpoints:
julia> d
(0.0..3.0 (open)) × (0.0..10.0 (open))
julia> f = Fun((ξ, σ) -> log_posterior(data, ξ, σ), d)
ERROR: ArgumentError: GeneralizedPareto: the condition σ > zero(σ) is not satisfied.
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Distributions/vR2pk/src/utils.jl:6 [inlined]
[2] #GeneralizedPareto#147
@ ~/.julia/packages/Distributions/vR2pk/src/univariate/continuous/generalizedpareto.jl:41 [inlined]
[3] GeneralizedPareto
@ ~/.julia/packages/Distributions/vR2pk/src/univariate/continuous/generalizedpareto.jl:41 [inlined]
[4] GeneralizedPareto
@ ~/.julia/packages/Distributions/vR2pk/src/univariate/continuous/generalizedpareto.jl:50 [inlined]
[5] #9
@ ./REPL[21]:1 [inlined]
[6] mapreduce_impl(f::var"#9#10"{Float64, Float64}, op::typeof(Base.add_sum), A::Vector{Float64}, ifirst::Int64, ilast::Int64, blksize::Int64)
@ Base ./reduce.jl:244
[7] mapreduce_impl
@ ./reduce.jl:259 [inlined]
[8] _mapreduce(f::var"#9#10"{Float64, Float64}, op::typeof(Base.add_sum), #unused#::IndexLinear, A::Vector{Float64})
@ Base ./reduce.jl:417
[9] _mapreduce_dim
@ ./reducedim.jl:330 [inlined]
[10] #mapreduce#725
@ ./reducedim.jl:322 [inlined]
[11] mapreduce
@ ./reducedim.jl:322 [inlined]
[12] #_sum#735
@ ./reducedim.jl:894 [inlined]
[13] _sum
@ ./reducedim.jl:894 [inlined]
[14] #sum#733
@ ./reducedim.jl:890 [inlined]
[15] sum
@ ./reducedim.jl:890 [inlined]
[16] log_like
@ ./REPL[21]:1 [inlined]
[17] log_posterior(x::Vector{Float64}, ξ::Float64, σ::Float64)
@ Main ./REPL[23]:1
[18] (::var"#31#32")(ξ::Float64, σ::Float64)
@ Main ./REPL[63]:1
[19] (::ApproxFunBase.DFunction)(::Float64, ::Vararg{Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/LinearAlgebra/helper.jl:647
[20] (::ApproxFunBase.var"#22#24"{ApproxFunBase.DFunction})(xy::StaticArrays.SVector{2, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:100
[21] (::ApproxFunBase.DFunction)(args::StaticArrays.SVector{2, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/LinearAlgebra/helper.jl:647
[22] _broadcast_getindex_evalf
@ ./broadcast.jl:670 [inlined]
[23] _broadcast_getindex
@ ./broadcast.jl:643 [inlined]
[24] getindex
@ ./broadcast.jl:597 [inlined]
[25] macro expansion
@ ./broadcast.jl:961 [inlined]
[26] macro expansion
@ ./simdloop.jl:77 [inlined]
[27] copyto!
@ ./broadcast.jl:960 [inlined]
[28] copyto!
@ ./broadcast.jl:913 [inlined]
[29] materialize!
@ ./broadcast.jl:871 [inlined]
[30] materialize!
@ ./broadcast.jl:868 [inlined]
[31] broadcast!(f::ApproxFunBase.DFunction, dest::Vector{Float64}, As::Vector{StaticArrays.SVector{2, Float64}})
@ Base.Broadcast ./broadcast.jl:837
[32] default_Fun(#unused#::Type{Float64}, f::Function, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64}, pts::Vector{StaticArrays.SVector{2, Float64}}, #unused#::Type{Val{false}})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:44
[33] default_Fun(f::ApproxFunBase.DFunction, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64}, n::Int64, #unused#::Type{Val{false}})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:57
[34] default_Fun(f::Function, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64}, n::Int64)
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:72
[35] default_Fun(f::ApproxFunBase.DFunction, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:121
[36] Fun(f::Function, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:177
[37] default_Fun(f::ApproxFunBase.DFunction, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:100
[38] Fun(f::Function, d::TensorSpace{Tuple{Chebyshev{OpenInterval{Float64}, Float64}, Chebyshev{OpenInterval{Float64}, Float64}}, VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}}, Float64})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:177
[39] Fun(f::Function, d::VcatDomain{2, Float64, (1, 1), Tuple{OpenInterval{Float64}, OpenInterval{Float64}}})
@ ApproxFunBase ~/.julia/packages/ApproxFunBase/vVgJc/src/constructors.jl:173
[40] top-level scope
@ REPL[63]:1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Julia example with Fun on the two-dimensional open interval and follow the ApproxFunBase entry points shown in the stack trace, especially default_Fun and constructors.jl. Determine whether endpoint samples are being generated despite the open domains; done should be demonstrated by the example no longer evaluating the invalid endpoint values without breaking valid open-interval construction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100