From 3292117261161463670d7f0e8feff10cf3808c02 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 17 Oct 2024 14:06:34 +0530 Subject: [PATCH 1/3] fix: fix `promote_symtype` in `register_array_symbolic` with `ndims` --- src/register.jl | 6 +++--- test/macro.jl | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/register.jl b/src/register.jl index ea9394891..8d1c01dc1 100644 --- a/src/register.jl +++ b/src/register.jl @@ -129,7 +129,7 @@ function register_array_symbolic(f, ftype, argnames, Ts, ret_type, partial_defs if define_promotion container_type = get(defs, :container_type, :($propagate_atype(f, $(argnames...)))) etype = get(defs, :eltype, :($propagate_eltype(f, $(argnames...)))) - ndims = get(defs, :ndims, nothing) + ndim = get(defs, :ndims, nothing) is_callable_struct = f isa Expr && f.head == :(::) fn_arg = if is_callable_struct f @@ -147,10 +147,10 @@ function register_array_symbolic(f, ftype, argnames, Ts, ret_type, partial_defs container_type = $container_type etype = $etype $( - if ndims === nothing + if ndim === nothing :(return container_type{etype}) else - :(ndims = $ndims; return container_type{etype, ndims}) + :(ndim = $ndim; return container_type{etype, ndim}) end ) end diff --git a/test/macro.jl b/test/macro.jl index a9bc912d8..062273b54 100644 --- a/test/macro.jl +++ b/test/macro.jl @@ -54,6 +54,16 @@ let end # ndims specified + +# in terms of argument +@register_array_symbolic ggg(x::AbstractVector) begin + container_type=SymMatrix + size=(length(x) * 2, length(x) * 2) + eltype=eltype(x) + ndims = ndims(x) + 1 +end +@test promote_symtype(ggg, symtype(unwrap(x))) == SymMatrix{Real, 2} + @register_array_symbolic ggg(x::AbstractVector) begin container_type=SymMatrix size=(length(x) * 2, length(x) * 2) From 703d2e9390612519de5df956a5745cc4cb2e3d96 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 17 Oct 2024 16:03:00 +0530 Subject: [PATCH 2/3] fix: disable precompilation workload in GroebnerExt Depends on NemoExt, which won't be loaded due to https://github.com/JuliaLang/julia/pull/55589 --- ext/SymbolicsGroebnerExt.jl | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ext/SymbolicsGroebnerExt.jl b/ext/SymbolicsGroebnerExt.jl index 66d069060..fa89330ee 100644 --- a/ext/SymbolicsGroebnerExt.jl +++ b/ext/SymbolicsGroebnerExt.jl @@ -317,15 +317,4 @@ function Symbolics.solve_multivar(eqs::Vector, vars::Vector{Num}; dropmultiplici sol end -# Helps with precompilation time -PrecompileTools.@setup_workload begin - @variables a b c x y z - simple_linear_equations = [x - y, y + 2z] - equations_intersect_sphere_line = [x^2 + y^2 + z^2 - 9, x - 2y + 3, y - z] - PrecompileTools.@compile_workload begin - symbolic_solve(simple_linear_equations, [x, y], warns=false) - symbolic_solve(equations_intersect_sphere_line, [x, y, z], warns=false) - end -end - end # module From 16ad8dc0b943efbc12e0c104006ae77731f01e73 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Fri, 18 Oct 2024 17:43:38 +0530 Subject: [PATCH 3/3] test: update reference tests --- test/build_function_tests/intermediate-exprs-inplace.jl | 2 +- test/build_function_tests/intermediate-exprs-outplace.jl | 2 +- test/build_function_tests/manual-limits-inplace.jl | 2 +- test/build_function_tests/manual-limits-outplace.jl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/build_function_tests/intermediate-exprs-inplace.jl b/test/build_function_tests/intermediate-exprs-inplace.jl index 3fb9bcc88..f81204b48 100644 --- a/test/build_function_tests/intermediate-exprs-inplace.jl +++ b/test/build_function_tests/intermediate-exprs-inplace.jl @@ -5,7 +5,7 @@ begin for (j, j′) = zip(1:5, reset_to_one(1:5)) for (i, i′) = zip(1:5, reset_to_one(1:5)) - _out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (limit)((+)(-1, i), 5), (limit)((+)(1, j), 5))) + _out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5))) end end end diff --git a/test/build_function_tests/intermediate-exprs-outplace.jl b/test/build_function_tests/intermediate-exprs-outplace.jl index 4b0add1c5..8113cf9e1 100644 --- a/test/build_function_tests/intermediate-exprs-outplace.jl +++ b/test/build_function_tests/intermediate-exprs-outplace.jl @@ -4,7 +4,7 @@ begin for (j, j′) = zip(1:5, reset_to_one(1:5)) for (i, i′) = zip(1:5, reset_to_one(1:5)) - _out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (limit)((+)(-1, i), 5), (limit)((+)(1, j), 5))) + _out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5))) end end end diff --git a/test/build_function_tests/manual-limits-inplace.jl b/test/build_function_tests/manual-limits-inplace.jl index 2814ef2b7..5c8590138 100644 --- a/test/build_function_tests/manual-limits-inplace.jl +++ b/test/build_function_tests/manual-limits-inplace.jl @@ -3,7 +3,7 @@ begin for (j, j′) = zip(1:5, reset_to_one(1:5)) for (i, i′) = zip(1:5, reset_to_one(1:5)) - ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (limit)((+)(-1, i), 5), (limit)((+)(1, j), 5))) + ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5))) end end end diff --git a/test/build_function_tests/manual-limits-outplace.jl b/test/build_function_tests/manual-limits-outplace.jl index 4871adf9d..85d19be7b 100644 --- a/test/build_function_tests/manual-limits-outplace.jl +++ b/test/build_function_tests/manual-limits-outplace.jl @@ -2,7 +2,7 @@ begin for (j, j′) = zip(1:5, reset_to_one(1:5)) for (i, i′) = zip(1:5, reset_to_one(1:5)) - ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (limit)((+)(-1, i), 5), (limit)((+)(1, j), 5))) + ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5))) end end end