Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoStrouwen committed Apr 11, 2024
1 parent 98eb805 commit a50d86f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
23 changes: 11 additions & 12 deletions docs/src/complete_sii.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function SymbolicIndexingInterface.all_symbols(sys::ExampleSystem)
end

function SymbolicIndexingInterface.default_values(sys::ExampleSystem)
return sys.defaults
return sys.defaults
end
```

Expand Down Expand Up @@ -360,26 +360,26 @@ Introducing a type to represent expression trees:

```julia
struct MyExpr
op::Function
args::Vector{Union{MyExpr, MySym, MySymArr, Number, Array}}
op::Function
args::Vector{Union{MyExpr, MySym, MySymArr, Number, Array}}
end
```

[`symbolic_evaluate`](@ref) can be implemented as follows:

```julia
function symbolic_evaluate(expr::Union{MySym, MySymArr}, syms::Dict)
get(syms, expr, expr)
get(syms, expr, expr)
end
function symbolic_evaluate(expr::MyExpr, syms::Dict)
for i in eachindex(expr.args)
if expr.args[i] isa Union{MySym, MySymArr, MyExpr}
expr.args[i] = symbolic_evaluate(expr.args[i], syms)
for i in eachindex(expr.args)
if expr.args[i] isa Union{MySym, MySymArr, MyExpr}
expr.args[i] = symbolic_evaluate(expr.args[i], syms)
end
end
if all(x -> symbolic_type(x) === NotSymbolic(), expr.args)
return expr.op(expr.args...)
end
end
if all(x -> symbolic_type(x) === NotSymbolic(), expr.args)
return expr.op(expr.args...)
end
end
```

Expand Down Expand Up @@ -429,7 +429,6 @@ end
SymbolicIndexingInterface.parameter_timeseries(fs::ExampleSolution2) = fs.pt
# Mark the object as a `Timeseries` object
SymbolicIndexingInterface.is_timeseries(::Type{ExampleSolution2}) = Timeseries()
```

Now we can create an example object and observe the new functionality. Note that
Expand Down
2 changes: 1 addition & 1 deletion docs/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ changing the type of values in the buffer (for example, changing the value of a
from `Float64` to `Float32`).

```@example Usage
remake_buffer(sys, prob.p, Dict(σ => 1f0, ρ => 2f0, β => 3f0))
remake_buffer(sys, prob.p, Dict(σ => 1.0f0, ρ => 2.0f0, β => 3.0f0))
```
2 changes: 1 addition & 1 deletion src/parameter_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ By default, this function returns `parameter_values(p)` regardless of `i`, and o
to be specialized for timeseries objects where parameter values are not constant at all
times. The resultant object should be indexable using [`parameter_values`](@ref).
If this function is implemented, [`parameter_values_at_state_time`](@ref) must be
If this function is implemented, [`parameter_values_at_state_time`](@ref) must be
implemented for [`getu`](@ref) to work correctly.
"""
function parameter_values_at_time end
Expand Down
2 changes: 1 addition & 1 deletion src/trait.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ not present as keys in `syms`.
The function can take additional keyword arguments to control implementation-specific
behavior.
This is already implemented for
This is already implemented for
`symbolic_evaluate(expr::Union{Symbol, Expr}, syms::Dict)`.
"""
function symbolic_evaluate(expr::Union{Symbol, Expr}, syms::Dict)
Expand Down

0 comments on commit a50d86f

Please sign in to comment.