-
-
Notifications
You must be signed in to change notification settings - Fork 233
Description
This is a question I expect the answer to be no too, so that's fine.
In my system I have a lot of vector variables ~ 500 values in length. The equations often use at least 4 of these vectors to generate a new vector. To get the simplifaction to work I am having to do scalarize(eq) on each equation but this creates thousands of equations and inside of each thousands of 'pseudo-parameters' (not sure how scalarize works but when I print it it says stuff like vec[1],vec[2] inside of the function call). A lot of these equations are containing registered components which I know is an issue form other posts.
All of this seems to lead to a large amount of looping over thousands of equations and variables (alias_elimination!() takes forever in the structural_simplify) and I wondered if there was a way to write the equations without scalarizing so that there is 5 vector variables and 10 equations rather than thousands of each making the simplifcation take a reasonable amount of time as at the moment it's slower than the solve call
I hope someone can say yes but I am assuming it's a no. An MWE is below where the final output is 10 equations and 10 unknowns rather than 1 and 1.
@mtkmodel test begin
@variables begin
vec(t)[1:10]
end
@parameters begin
a
b
c
end
@equations begin
D(vec) ~ registered_func(vec,a,b,c).+t
end
end
function registered_func(vec,a,b,c)
return (vec.+c)*a/b
end
@register_array_symbolic registered_func(vec::AbstractVector,a::Num,b::Num,c::Num) begin
size=(length(vec),)
eltype=eltype(vec)
end
@mtkbuild sys = test()