Hi,
I have the following function:
def is_caught(doc, rule):
return rule.xreplace({key: key in doc for key in rule.atoms()}) == True
# I have tested it also with subs instead of xreplace
This function's input is a doc which is a set of Sympy symbols, i.e.
set([x,y]) and a boolean rule, i.e. And(x,z).
The function returns True if the rule is satisfied by the doc, in the above
example it returns False.
I have profiled my code and 99% of the time is taken by this function. The
rules and docs aren't complicated but I have a lot of them, i.e. 10 symbols
over 5000 rules.
Is there any way to speed this up?
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/24633db5-dace-4b5d-a597-d09c031465b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.