Symbolics.jl
Symbolics.jl copied to clipboard
Update build function documentation
https://symbolics.juliasymbolics.org/dev/manual/build_function/ seems to be written back when there was only scalar. How does build function now work for functions that contain vector/matrix operations? Sentences like "If ex is an array of > 1500 non-zero expressions then ShardedForm(80, 4) is used." are not applicable if the ex is not scalarized?
I'm not sure what build_function
does on symbolic arrays right now, @shashi is it complete enough to start documenting there?
julia> using Symbolics
julia> @variables a[1:2]
1-element Vector{Symbolics.Arr{Num, 1}}:
a[1:2]
julia> b = 1/2*a.^2
(broadcast(*, 0.5, broadcast(literal_pow, Base.RefValue{typeof(^)}(^), a, Base.RefValue{Val{2}}(Val{2}()))))[1:2]
julia> Symbolics.build_function(b,a)
:(function (a,)
#= C:\Users\arno\.julia\packages\SymbolicUtils\v2ZkM\src\code.jl:349 =#
#= C:\Users\arno\.julia\packages\SymbolicUtils\v2ZkM\src\code.jl:350 =#
#= C:\Users\arno\.julia\packages\SymbolicUtils\v2ZkM\src\code.jl:351 =#
(broadcast)(*, 0.5, (broadcast)(Base.literal_pow, Base.RefValue{typeof(^)}(^), a, Base.RefValue{Val{2}}(Val{2}())))
end)
julia> eval(Symbolics.build_function(b,a))([1,2,3])
3-element Vector{Float64}:
0.5
2.0
4.5
what is the status of this issue? I am currently dealing with the ambiguity of the return value of build_function
as described above (vs what is described in the documentation: https://symbolics.juliasymbolics.org/stable/tutorials/symbolic_functions/)
Yes it won't switch to ShardedForm
if it's not scalarized.