Closed albertomercurio closed 2 years ago
Hello,
I'm implementing a non-commuting algebra, which is goverded by the rules of quantum operators, for example a b - b a = 1.
I'm developing a Julia package, which is hosted by this repo. I followed the source code of this repository, and I copied the simplify_rules.jl file.
simplify_rules.jl
However, when I apply the serial_simplifier or the serial_expand_simplifier it fails.
serial_simplifier
serial_expand_simplifier
julia> using SecondQuantization julia> simplify(b * a, rewriter = serial_simplifier()) MethodError: no method matching (::Metatheory.Rewriters.Fixpoint{Metatheory.Rewriters.IfElse{typeof(SymbolicUtils.has_trig_exp), Metatheory.Rewriters.Walk{:post, Metatheory.Rewriters.IfElse{SecondQuantization.var"#84#157", Metatheory.Rewriters.Chain, Metatheory.Rewriters.IfElse{SecondQuantization.var"#85#158", Metatheory.Rewriters.Chain, Metatheory.Rewriters.Empty}}, typeof(TermInterface.similarterm), false}, Metatheory.Rewriters.Walk{:post, Metatheory.Rewriters.Chain, typeof(TermInterface.similarterm), false}}})() Closest candidates are: (::Metatheory.Rewriters.Fixpoint)(!Matched::Any) at ~/.julia/packages/Metatheory/XcKKW/src/Rewriters.jl:116
And it is strange, since if I import the rewriter it works
julia> using SymbolicUtils, SymbolicUtils.Rewriters julia> simplify(b * a, rewriter = If(istree, Fixpoint(default_simplifier()))) a * b
but If(istree, Fixpoint(default_simplifier())) is exactly the serial_simplifier!
If(istree, Fixpoint(default_simplifier()))
The stranger thing is that if I run the threaded_simplifier it works
threaded_simplifier
julia> simplify(b * a, rewriter = threaded_simplifier(100)) a * b
It was easy! The correct expression is without the brackets ()
julia> simplify(b * a, rewriter = serial_simplifier) a*b
Hello,
I'm implementing a non-commuting algebra, which is goverded by the rules of quantum operators, for example a b - b a = 1.
I'm developing a Julia package, which is hosted by this repo. I followed the source code of this repository, and I copied the
simplify_rules.jl
file.However, when I apply the
serial_simplifier
or theserial_expand_simplifier
it fails.And it is strange, since if I import the rewriter it works
but
If(istree, Fixpoint(default_simplifier()))
is exactly theserial_simplifier
!The stranger thing is that if I run the
threaded_simplifier
it works