diff --git a/ext/SymbolicsGroebnerExt.jl b/ext/SymbolicsGroebnerExt.jl index 491c717aa..0d9c3f8fb 100644 --- a/ext/SymbolicsGroebnerExt.jl +++ b/ext/SymbolicsGroebnerExt.jl @@ -303,18 +303,17 @@ 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 equation1 = a*log(x)^b + c ~ 0 equation_actually_polynomial = sin(x^2 +1)^2 + sin(x^2 + 1) + 3 simple_linear_equations = [x - y, y + 2z] - expr_with_params = expand((x + b)*(x^2 + 2x + 1)*(x^2 - a)) equations_intersect_sphere_line = [x^2 + y^2 + z^2 - 9, x - 2y + 3, y - z] PrecompileTools.@compile_workload begin symbolic_solve(equation1, x) symbolic_solve(equation_actually_polynomial) symbolic_solve(simple_linear_equations, [x, y]) - symbolic_solve(expr_with_params, x, dropmultiplicity=false) symbolic_solve(equations_intersect_sphere_line, [x, y, z]) end end diff --git a/ext/SymbolicsNemoExt.jl b/ext/SymbolicsNemoExt.jl index 137a7660f..f40205289 100644 --- a/ext/SymbolicsNemoExt.jl +++ b/ext/SymbolicsNemoExt.jl @@ -1,5 +1,6 @@ module SymbolicsNemoExt using Nemo +import Symbolics.PrecompileTools if isdefined(Base, :get_extension) using Symbolics @@ -73,4 +74,16 @@ function Symbolics.gcd_use_nemo(poly1::Num, poly2::Num) return sym_gcd end + +# Helps with precompilation time +PrecompileTools.@setup_workload begin + @variables a b c x y z + expr_with_params = expand((x + b)*(x^2 + 2x + 1)*(x^2 - a)) + PrecompileTools.@compile_workload begin + symbolic_solve(expr_with_params, x, dropmultiplicity=false) + symbolic_solve(x^10 - a^10, x, dropmultiplicity=false) + symbolic_solve([x^2 - a^2, x + a], x) + end +end + end # module diff --git a/test/solver.jl b/test/solver.jl index 26f7bfaf8..6c9e4a905 100644 --- a/test/solver.jl +++ b/test/solver.jl @@ -175,6 +175,7 @@ end @testset "Multipoly solver" begin @test isequal(symbolic_solve([x^2 - 1, x + 1], x)[1], -1) @test isequal(symbolic_solve([x^2 - a^2, x + a], x)[1], -a) + @test isequal(symbolic_solve([x^20 - a^20, x + a], x)[1], -a) end @testset "Multivar solver" begin @variables x y z