You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on what I feed into build_function, the order of the output varies, i.e., out-of-place first or in-place first. With Symbolics v6.22.0, the following MWE
using Symbolics
@variables a[1:2]
@variables b[1:2]
f = a .- b
g = [a[i] - b[i] for i in eachindex(a,b)]
println("typeof(f) = $(typeof(f))")
println("typeof(g) = $(typeof(g))")
F = build_function(f, a, b; nanmath = false)
G = build_function(g, a, b; nanmath = false)
println("\nThis is F:")
println(F)
println("\nThis is G:")
println(G)
produces
typeof(f) = Symbolics.Arr{Num, 1}
typeof(g) = Vector{Num}
This is F:
(:(function (ˍ₋out, a, b)
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:385 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:386 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:387 =#
begin
#= /Users/mkraus/.julia/packages/Symbolics/YbNrd/src/arrays.jl:1124 =#
for (i, i′) = zip(1:2, reset_to_one(1:2))
#= /Users/mkraus/.julia/packages/Symbolics/YbNrd/src/arrays.jl:1112 =#
ˍ₋out[i′] = (+)(ˍ₋out[i′], (-)((getindex)(a, i), (getindex)(b, i)))
#= /Users/mkraus/.julia/packages/Symbolics/YbNrd/src/arrays.jl:1113 =#
end
end
end), :(function (a, b)
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:385 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:386 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:387 =#
(broadcast)(-, a, b)
end))
This is G:
(:(function (a, b)
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:385 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:386 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:387 =#
begin
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:480 =#
(SymbolicUtils.Code.create_array)(Array, nothing, Val{1}(), Val{(2,)}(), (+)((getindex)(a, 1), (*)(-1, (getindex)(b, 1))), (+)((getindex)(a, 2), (*)(-1, (getindex)(b, 2))))
end
end), :(function (ˍ₋out, a, b)
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:385 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:386 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:387 =#
begin
#= /Users/mkraus/.julia/packages/Symbolics/YbNrd/src/build_function.jl:546 =#
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:434 =# @inbounds begin
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:430 =#
ˍ₋out[1] = (+)((getindex)(a, 1), (*)(-1, (getindex)(b, 1)))
ˍ₋out[2] = (+)((getindex)(a, 2), (*)(-1, (getindex)(b, 2)))
#= /Users/mkraus/.julia/packages/SymbolicUtils/jf8aQ/src/code.jl:432 =#
nothing
end
end
end))
Is this intended behaviour?
The text was updated successfully, but these errors were encountered:
Depending on what I feed into
build_function
, the order of the output varies, i.e., out-of-place first or in-place first. With Symbolics v6.22.0, the following MWEproduces
Is this intended behaviour?
The text was updated successfully, but these errors were encountered: