Skip to content

Commit

Permalink
fixup! fix: fix remake for symbolic indexing, add tests for remake
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Mar 8, 2024
1 parent 2b7079a commit a7f661a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/problems/basic_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,5 @@ struct SampledIntegralProblem{Y, X, K} <: AbstractIntegralProblem{false}
new{typeof(y), typeof(x), typeof(kwargs)}(y, x, dim, kwargs)
end
end

SymbolicIndexingInterface.state_values(::AbstractIntegralProblem) = nothing

Check warning on line 564 in src/problems/basic_problems.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/basic_problems.jl#L564

Added line #L564 was not covered by tests
5 changes: 5 additions & 0 deletions src/problems/noise_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ end
_tspan = promote_tspan(tspan)
NoiseProblem{typeof(noise), typeof(_tspan), typeof(kwargs)}(noise, _tspan, seed, kwargs)
end

SymbolicIndexingInterface.parameter_values(::NoiseProblem) = nothing
SymbolicIndexingInterface.is_parameter(::NoiseProblem) = false
SymbolicIndexingInterface.parameter_index(::NoiseProblem) = nothing
SymbolicIndexingInterface.parameter_symbols(::NoiseProblem) = []

Check warning on line 19 in src/problems/noise_problems.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/noise_problems.jl#L16-L19

Added lines #L16 - L19 were not covered by tests
12 changes: 3 additions & 9 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,14 @@ function updated_u0_p(prob, u0, p; interpret_symbolicmap = true)
end

function updated_u0(prob, u0, p)
if u0 === missing
return copy(state_values(prob))
if u0 === missing || u0 isa Function
return state_values(prob)
end
if u0 isa Number
return u0
end
if eltype(u0) <: Pair
u0 = Dict(u0)
elseif u0 isa AbstractArray
if length(u0) == length(state_values(prob))
return u0
else
throw(ArgumentError("Invalid value for u0: $u0. New length ($length(u0)) does not match length of current problem ($(length(state_values(prob))))"))
end
else
return u0
end
Expand Down Expand Up @@ -386,7 +380,7 @@ end

function updated_p(prob, p; interpret_symbolicmap = true)
if p === missing
return copy(parameter_values(prob))
return parameter_values(prob)
end
if eltype(p) <: Pair
if interpret_symbolicmap
Expand Down

0 comments on commit a7f661a

Please sign in to comment.