Skip to content

Conversation

AayushSabharwal
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JuliaFormatter

[JuliaFormatter] reported by reviewdog 🐶

SymbolicUtils.promote_symtype(::typeof(instream_rt), ::Type{T}, ::Type{S}, ::Type{R}) where {T, S, R} = Real


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

const MaybeArrayIndexT = Union{Int, UnitRange{Int}, Base.ReshapedArray{Int, N, UnitRange{Int}} where {N}}


[JuliaFormatter] reported by reviewdog 🐶

parse_callbacks_for_discretes!(cevs, disc_param_callbacks, constant_buffers, nonnumeric_buffers, 0)
parse_callbacks_for_discretes!(devs, disc_param_callbacks, constant_buffers, nonnumeric_buffers, length(cevs))


[JuliaFormatter] reported by reviewdog 🐶

push!(disc_syms_by_symtype_by_partition[i], filter(==(partition) Base.Fix1(getindex, disc_param_callbacks), buffer))


[JuliaFormatter] reported by reviewdog 🐶

push!(disc_buffer_templates, map(Base.Fix1(BufferTemplate, symtype) length, disc_syms_by_partition))


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f, args) => begin
f === getindex && (idx = get(disc_idxs, args[1], nothing)) !== nothing
end
_ => false


[JuliaFormatter] reported by reviewdog 🐶

function parse_callbacks_for_discretes!(events::Vector, disc_param_callbacks::Dict{SymbolicT, BitSet}, constant_buffers::Dict{TypeT, Set{SymbolicT}}, nonnumeric_buffers::Dict{TypeT, Set{SymbolicT}}, offset::Int)


[JuliaFormatter] reported by reviewdog 🐶

function SymbolicIndexingInterface.parameter_index(ic::IndexCache, sym::Union{Num, Symbolics.Arr, Symbolics.CallAndWrap})


[JuliaFormatter] reported by reviewdog 🐶

function check_index_map(idxmap::Dict{SymbolicT, V}, sym::SymbolicT)::Union{V, Nothing} where {V}


[JuliaFormatter] reported by reviewdog 🐶

mask[i] = !iscall(eq.rhs) || operation(eq.rhs) !== StructuralTransformations.change_origin


[JuliaFormatter] reported by reviewdog 🐶

if (checks isa Bool && checks === true || checks isa Int && (checks & CheckComponents) > 0) && iv !== nothing


[JuliaFormatter] reported by reviewdog 🐶


[JuliaFormatter] reported by reviewdog 🐶

fullvars[i], discmap; filterer = Symbolics.FPSubFilterer{Union{Sample, Hold, Pre}}()))


[JuliaFormatter] reported by reviewdog 🐶

issym(op) && return SSym(nameof(op); type = FnType{Tuple{symtype(iv)}, Real}, shape = SU.ShapeVecT())(iv)


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f) && if f isa Differential end => begin


[JuliaFormatter] reported by reviewdog 🐶

function process_variables!(var_to_name::Dict{Symbol, SymbolicT}, defs::SymmapT, guesses::SymmapT, vars::Vector{SymbolicT})


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f, args) && if f === getindex end => args[1]


[JuliaFormatter] reported by reviewdog 🐶

hasmetadata(x, VariableSource) || iscall(x) && operation(x) === getindex && isvariable(arguments(x)[1])::Bool


[JuliaFormatter] reported by reviewdog 🐶

function collect_scoped_vars!(unknowns::OrderedSet{SymbolicT}, parameters::OrderedSet{SymbolicT}, sys::AbstractSystem, iv::Union{SymbolicT, Nothing}; depth = 1, op = Differential)


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f) && if f isa O end => true


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f) && if f isa Operator end => f isa O


[JuliaFormatter] reported by reviewdog 🐶

function collect_vars!(unknowns::OrderedSet{SymbolicT}, parameters::OrderedSet{SymbolicT}, expr::SymbolicT, iv::Union{SymbolicT, Nothing}; depth = 0, op = Symbolics.Operator)


[JuliaFormatter] reported by reviewdog 🐶

function collect_vars!(unknowns::OrderedSet{SymbolicT}, parameters::OrderedSet{SymbolicT}, expr::AbstractArray{SymbolicT}, iv::Union{SymbolicT, Nothing}; depth = 0, op = Symbolics.Operator)


[JuliaFormatter] reported by reviewdog 🐶

check_scope_depth(getmetadata(var, SymScope, LocalScope())::AllScopes, depth) || return nothing


[JuliaFormatter] reported by reviewdog 🐶

iscall(x) && operation(x) === getindex && return safe_getmetadata(m, arguments(x)[1], default)


[JuliaFormatter] reported by reviewdog 🐶

BSImpl.Term(; f, args, shape, type, metadata) && if f isa Operator end => begin


[JuliaFormatter] reported by reviewdog 🐶

getunshifted(x::SymbolicT) = Symbolics.getmetadata(x, VariableUnshifted, nothing)::Union{SymbolicT, Nothing}

Comment on lines +361 to +442
fold1 = Val{false}()
using SymbolicUtils
using SymbolicUtils: shape
using Symbolics
@syms x y f(t) q[1:5]
SymbolicUtils.Sym{SymReal}(:a; type = Real, shape = SymbolicUtils.ShapeVecT())
x + y
x * y
x / y
x ^ y
x ^ 5
6 ^ x
x - y
-y
2y
z = 2
dict = SymbolicUtils.ACDict{VartypeT}()
dict[x] = 1
dict[y] = 1
type::typeof(DataType) = rand() < 0.5 ? Real : Float64
nt = (; type, shape, unsafe = true)
Base.pairs(nt)
BSImpl.AddMul{VartypeT}(1, dict, SymbolicUtils.AddMulVariant.MUL; type, shape = SymbolicUtils.ShapeVecT(), unsafe = true)
*(y, z)
*(z, y)
SymbolicUtils.symtype(y)
f(x)
(5x / 5)
expand((x + y) ^ 2)
simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
rules2 = Dict(x => 1)
Dx = Differential(x)
Differential(y)(ex)
uex = unwrap(ex)
Symbolics.executediff(Dx, uex)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
substitute(ex, rules2; fold = fold1)
@variables foo
f(foo)
@variables x y f(::Real) q[1:5]
x + y
x * y
x / y
x ^ y
x ^ 5
# 6 ^ x
x - y
-y
2y
symtype(y)
z = 2
*(y, z)
*(z, y)
f(x)
(5x / 5)
[x, y]
[x, f, f]
promote_type(Int, Num)
promote_type(Real, Num)
promote_type(Float64, Num)
# expand((x + y) ^ 2)
# simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
# rules2 = Dict(x => 1)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
Symbolics.linear_expansion(ex, y)
# substitute(ex, rules2; fold = fold1)
# substitute(ex, rules2)
# substitute(ex, rules1; fold = fold2)
# substitute(ex, rules2; fold = fold2)
q[1]
q'q
using ModelingToolkit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
fold1 = Val{false}()
using SymbolicUtils
using SymbolicUtils: shape
using Symbolics
@syms x y f(t) q[1:5]
SymbolicUtils.Sym{SymReal}(:a; type = Real, shape = SymbolicUtils.ShapeVecT())
x + y
x * y
x / y
x ^ y
x ^ 5
6 ^ x
x - y
-y
2y
z = 2
dict = SymbolicUtils.ACDict{VartypeT}()
dict[x] = 1
dict[y] = 1
type::typeof(DataType) = rand() < 0.5 ? Real : Float64
nt = (; type, shape, unsafe = true)
Base.pairs(nt)
BSImpl.AddMul{VartypeT}(1, dict, SymbolicUtils.AddMulVariant.MUL; type, shape = SymbolicUtils.ShapeVecT(), unsafe = true)
*(y, z)
*(z, y)
SymbolicUtils.symtype(y)
f(x)
(5x / 5)
expand((x + y) ^ 2)
simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
rules2 = Dict(x => 1)
Dx = Differential(x)
Differential(y)(ex)
uex = unwrap(ex)
Symbolics.executediff(Dx, uex)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
substitute(ex, rules2; fold = fold1)
@variables foo
f(foo)
@variables x y f(::Real) q[1:5]
x + y
x * y
x / y
x ^ y
x ^ 5
# 6 ^ x
x - y
-y
2y
symtype(y)
z = 2
*(y, z)
*(z, y)
f(x)
(5x / 5)
[x, y]
[x, f, f]
promote_type(Int, Num)
promote_type(Real, Num)
promote_type(Float64, Num)
# expand((x + y) ^ 2)
# simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
# rules2 = Dict(x => 1)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
Symbolics.linear_expansion(ex, y)
# substitute(ex, rules2; fold = fold1)
# substitute(ex, rules2)
# substitute(ex, rules1; fold = fold2)
# substitute(ex, rules2; fold = fold2)
q[1]
q'q
using ModelingToolkit
fold1 = Val{false}()
using SymbolicUtils
using SymbolicUtils: shape
using Symbolics
@syms x y f(t) q[1:5]
SymbolicUtils.Sym{SymReal}(:a; type = Real, shape = SymbolicUtils.ShapeVecT())
x + y
x * y
x / y
x ^ y
x ^ 5
6 ^ x
x - y
-y
2y
z = 2
dict = SymbolicUtils.ACDict{VartypeT}()
dict[x] = 1
dict[y] = 1
type::typeof(DataType) = rand() < 0.5 ? Real : Float64
nt = (; type, shape, unsafe = true)
Base.pairs(nt)
BSImpl.AddMul{VartypeT}(1, dict, SymbolicUtils.AddMulVariant.MUL; type,
shape = SymbolicUtils.ShapeVecT(), unsafe = true)
*(y, z)
*(z, y)
SymbolicUtils.symtype(y)
f(x)
(5x / 5)
expand((x + y) ^ 2)
simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
rules2 = Dict(x => 1)
Dx = Differential(x)
Differential(y)(ex)
uex = unwrap(ex)
Symbolics.executediff(Dx, uex)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
substitute(ex, rules2; fold = fold1)
@variables foo
f(foo)
@variables x y f(::Real) q[1:5]
x + y
x * y
x / y
x ^ y
x ^ 5
# 6 ^ x
x - y
-y
2y
symtype(y)
z = 2
*(y, z)
*(z, y)
f(x)
(5x / 5)
[x, y]
[x, f, f]
promote_type(Int, Num)
promote_type(Real, Num)
promote_type(Float64, Num)
# expand((x + y) ^ 2)
# simplify(x ^ (1//2) + (sin(x) ^ 2 + cos(x) ^ 2) + 2(x + y) - x - y)
ex = x + 2y + sin(x)
rules1 = Dict(x => y)
# rules2 = Dict(x => 1)
# Running `fold = Val(true)` invalidates the precompiled statements
# for `fold = Val(false)` and itself doesn't precompile anyway.
# substitute(ex, rules1)
substitute(ex, rules1; fold = fold1)
Symbolics.linear_expansion(ex, y)
# substitute(ex, rules2; fold = fold1)
# substitute(ex, rules2)
# substitute(ex, rules1; fold = fold2)
# substitute(ex, rules2; fold = fold2)
q[1]
q'q
using ModelingToolkit

@named sys = System([ModelingToolkit.D_nounits(x) ~ -x], ModelingToolkit.t_nounits)
prob = ODEProblem(mtkcompile(sys), [x => 30.0], (0, 100), jac = true)
isequal(ModelingToolkit.D_nounits.x, ModelingToolkit.t_nounits)
sys = System([ModelingToolkit.D_nounits(x) ~ x], ModelingToolkit.t_nounits, [x], Num[]; name = :sys)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sys = System([ModelingToolkit.D_nounits(x) ~ x], ModelingToolkit.t_nounits, [x], Num[]; name = :sys)
sys = System([ModelingToolkit.D_nounits(x) ~ x],
ModelingToolkit.t_nounits, [x], Num[]; name = :sys)

Comment on lines +485 to +489
precompile(Tuple{typeof(Base.merge), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Nothing, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})
precompile(Tuple{typeof(Base.merge), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Base.ImmutableDict{DataType, Any}, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:id, :hash, :hash2), Tuple{Nothing, Int64, Int64}}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Base.ImmutableDict{DataType, Any}, Int64, Int64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, Nothing}}, Type{SymbolicUtils.BasicSymbolicImpl.Term{SymbolicUtils.SymReal}}})
precompile(Tuple{typeof(Symbolics.parse_vars), Symbol, Type, Tuple{Symbol, Symbol}, Function})
precompile(Tuple{typeof(Base.merge), NamedTuple{(:name, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{Symbol, Base.ImmutableDict{DataType, Any}, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
precompile(Tuple{typeof(Base.merge), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Nothing, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})
precompile(Tuple{typeof(Base.merge), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Base.ImmutableDict{DataType, Any}, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:id, :hash, :hash2), Tuple{Nothing, Int64, Int64}}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, SymbolicUtils.SmallVec{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, Array{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}, 1}}, Base.ImmutableDict{DataType, Any}, Int64, Int64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, Nothing}}, Type{SymbolicUtils.BasicSymbolicImpl.Term{SymbolicUtils.SymReal}}})
precompile(Tuple{typeof(Symbolics.parse_vars), Symbol, Type, Tuple{Symbol, Symbol}, Function})
precompile(Tuple{typeof(Base.merge), NamedTuple{(:name, :metadata, :hash, :hash2, :shape, :type, :id), Tuple{Symbol, Base.ImmutableDict{DataType, Any}, UInt64, UInt64, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}, DataType, SymbolicUtils.IDType}}, NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})
precompile(Tuple{typeof(Base.merge),
NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id),
Tuple{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
SymbolicUtils.SmallVec{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
Array{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
1}},
Nothing,
UInt64,
UInt64,
SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}},
DataType,
SymbolicUtils.IDType}},
NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})
precompile(Tuple{typeof(Base.merge),
NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id),
Tuple{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
SymbolicUtils.SmallVec{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
Array{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
1}},
Base.ImmutableDict{DataType, Any},
UInt64,
UInt64,
SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}},
DataType,
SymbolicUtils.IDType}},
NamedTuple{(:id, :hash, :hash2), Tuple{Nothing, Int64, Int64}}})
precompile(Tuple{typeof(Core.kwcall),
NamedTuple{(:f, :args, :metadata, :hash, :hash2, :shape, :type, :id),
Tuple{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
SymbolicUtils.SmallVec{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
Array{
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal},
1}},
Base.ImmutableDict{DataType, Any},
Int64,
Int64,
SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}},
DataType,
Nothing}},
Type{SymbolicUtils.BasicSymbolicImpl.Term{SymbolicUtils.SymReal}}})
precompile(Tuple{
typeof(Symbolics.parse_vars), Symbol, Type, Tuple{Symbol, Symbol}, Function})
precompile(Tuple{typeof(Base.merge),
NamedTuple{(:name, :metadata, :hash, :hash2, :shape, :type, :id),
Tuple{Symbol, Base.ImmutableDict{DataType, Any}, UInt64, UInt64,
SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}},
DataType, SymbolicUtils.IDType}},
NamedTuple{(:metadata,), Tuple{Base.ImmutableDict{DataType, Any}}}})

Comment on lines +491 to +492
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:name, :defaults), Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}}, Type{ModelingToolkit.System}, Array{Symbolics.Equation, 1}, Symbolics.Num, Array{Symbolics.Num, 1}, Array{Symbolics.Num, 1}})
precompile(Tuple{Type{NamedTuple{(:name, :defaults), T} where T<:Tuple}, Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:name, :defaults), Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}}, Type{ModelingToolkit.System}, Array{Symbolics.Equation, 1}, Symbolics.Num, Array{Symbolics.Num, 1}, Array{Symbolics.Num, 1}})
precompile(Tuple{Type{NamedTuple{(:name, :defaults), T} where T<:Tuple}, Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}})
precompile(Tuple{typeof(Core.kwcall),
NamedTuple{(:name, :defaults), Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}},
Type{ModelingToolkit.System}, Array{Symbolics.Equation, 1},
Symbolics.Num, Array{Symbolics.Num, 1}, Array{Symbolics.Num, 1}})
precompile(Tuple{Type{NamedTuple{(:name, :defaults), T} where T <: Tuple},
Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}}})

Comment on lines +494 to +496
precompile(Tuple{Type{NamedTuple{(:name, :defaults, :guesses), T} where T<:Tuple}, Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:name, :defaults, :guesses), Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}}, Type{ModelingToolkit.System}, Array{Symbolics.Equation, 1}, Symbolics.Num, Array{Symbolics.Num, 1}, Array{Symbolics.Num, 1}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:type, :shape), Tuple{DataType, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}}}, typeof(SymbolicUtils.term), Any, SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
precompile(Tuple{Type{NamedTuple{(:name, :defaults, :guesses), T} where T<:Tuple}, Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:name, :defaults, :guesses), Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}}, Type{ModelingToolkit.System}, Array{Symbolics.Equation, 1}, Symbolics.Num, Array{Symbolics.Num, 1}, Array{Symbolics.Num, 1}})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:type, :shape), Tuple{DataType, SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}}}, typeof(SymbolicUtils.term), Any, SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}})
precompile(Tuple{Type{NamedTuple{(:name, :defaults, :guesses), T} where T <: Tuple},
Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}})
precompile(Tuple{typeof(Core.kwcall),
NamedTuple{(:name, :defaults, :guesses),
Tuple{Symbol, Base.Dict{Symbolics.Num, Float64}, Base.Dict{Symbolics.Num, Float64}}},
Type{ModelingToolkit.System},
Array{Symbolics.Equation, 1},
Symbolics.Num,
Array{Symbolics.Num, 1},
Array{Symbolics.Num, 1}})
precompile(Tuple{typeof(Core.kwcall),
NamedTuple{(:type, :shape),
Tuple{DataType,
SymbolicUtils.SmallVec{Base.UnitRange{Int64}, Array{Base.UnitRange{Int64}, 1}}}},
typeof(SymbolicUtils.term),
Any,
SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymbolicUtils.SymReal}})

term = namespace_expr(term, sys, n; ivs)
end
expr = namespace_expr(expr, sys, n; ivs)
return BSImpl.ArrayOp{VartypeT}(output_idx, expr, reduce, term, ranges; type, shape, metadata)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
return BSImpl.ArrayOp{VartypeT}(output_idx, expr, reduce, term, ranges; type, shape, metadata)
return BSImpl.ArrayOp{VartypeT}(
output_idx, expr, reduce, term, ranges; type, shape, metadata)

for (i, eq) in enumerate(eqs)
empty!(varsbuf)
vars!(varsbuf, eq; op = Union{Differential, Initial, Pre})
SU.search_variables!(varsbuf, eq; is_atomic = OperatorIsAtomic{Union{Differential, Initial, Pre}}())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
SU.search_variables!(varsbuf, eq; is_atomic = OperatorIsAtomic{Union{Differential, Initial, Pre}}())
SU.search_variables!(varsbuf, eq; is_atomic = OperatorIsAtomic{Union{
Differential, Initial, Pre}}())

end

function observed2graph(eqs, unknowns)
function observed2graph(eqs::Vector{Equation}, unknowns::Vector{SymbolicT})::Tuple{BipartiteGraph{Int, Nothing}, Vector{Int}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
function observed2graph(eqs::Vector{Equation}, unknowns::Vector{SymbolicT})::Tuple{BipartiteGraph{Int, Nothing}, Vector{Int}}
function observed2graph(eqs::Vector{Equation},
unknowns::Vector{SymbolicT})::Tuple{BipartiteGraph{Int, Nothing}, Vector{Int}}

@set! sys.unknowns = s(get_unknowns(sys))
@set! sys.ps = s(get_ps(sys))
AffectSystem(sys, s(aff.unknowns), s(aff.parameters), s(aff.discretes))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

"""
const DDE_HISTORY_FUN = Sym{Symbolics.FnType{Tuple{Any, <:Real}, Vector{Real}}}(:___history___)
const BVP_SOLUTION = Sym{Symbolics.FnType{Tuple{<:Real}, Vector{Real}}}(:__sol__)
const DDE_HISTORY_FUN = SSym(:___history___; type = SU.FnType{Tuple{Any, <:Real}, Vector{Real}}, shape = SU.Unknown(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
const DDE_HISTORY_FUN = SSym(:___history___; type = SU.FnType{Tuple{Any, <:Real}, Vector{Real}}, shape = SU.Unknown(1))
const DDE_HISTORY_FUN = SSym(
:___history___; type = SU.FnType{Tuple{Any, <:Real}, Vector{Real}}, shape = SU.Unknown(1))

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 this pull request may close these issues.

1 participant