-
-
Notifications
You must be signed in to change notification settings - Fork 45
[WIP] Import and unify the rule syntax and classical pattern matching system from SymbolicUtils.jl #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nue from patterns_syntax.jl:69
|
This is the first (and biggest) step for https://discourse.julialang.org/t/a-recap-of-the-state-of-the-symbolics-ecosystem/68022 |
…lding dynamic function with macro, language should be the same with SU
|
@shashi it seems downporting the pattern matcher was super easy. I have made a few improvements I'll benchmark later. |
|
Getting good progress: julia> using SymbolicUtils, Metatheory, BenchmarkTools
[ Info: Precompiling Metatheory [e9d8d322-4543-424a-9be4-0cc815abe26c]
WARNING: could not import EGraphs.Rule into Schedulers
┌ Info: NOTE: The current implementation of the Metatheory library currently works
└ correctly only with the EGraphs backend.
julia> @syms x y
(x, y)
julia> f(x) = x^2
f (generic function with 1 method)
julia> g(x) = x/2
g (generic function with 1 method)
julia> rsymb = @btime SymbolicUtils.@rule f(~a, g(~b, 3)) => f(~b * ~a)
4.100 μs (59 allocations: 2.03 KiB)
f(~a, g(~b, 3)) => f(~b * ~a)
julia> rmeta = @btime Metatheory.@methodrule f(~a, g(~b, 3)) => f(~b * ~a)
7.260 μs (130 allocations: 5.81 KiB)
f(~a, g(~b, 3)) => f(~b * ~a)
julia> ex = term(f, x, term(g, y, 3))
f(x, g(y, 3))
julia> @btime rsymb(ex)
2.863 μs (64 allocations: 2.78 KiB)
(x^2)*(y^2)
julia> @btime rmeta(ex)
2.482 μs (64 allocations: 3.31 KiB)
(x^2)*(y^2) |
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
- Coverage 77.23% 76.69% -0.54%
==========================================
Files 34 15 -19
Lines 1287 1416 +129
==========================================
+ Hits 994 1086 +92
- Misses 293 330 +37
Continue to review full report at Codecov.
|
[WIP] Import and unify the rule syntax and classical pattern matching system from SymbolicUtils.jl
Uh oh!
There was an error while loading. Please reload this page.