On profiling my code I found it spent a lot of time in subs, particularly the subs call at the end of linsolve where it substitutes in your given free variables for the dummy parameters from gauss_jordan_solve. If I replace subs with xreplace I get a 10x speedup in the substitution process (250x without fastcache!).
Are there any possible pitfalls in doing this? My understanding is the advantage of subs over xreplace is that it is mathematically aware, so (x**4).subs(x**2, y) will yield y**2 for example, while the same would not work for xreplace. But if one is always replacing just a free symbol, such as replacing the dummy symbol in linsolve, surely the two are equivalent? If so, should linsolve just use xreplace? On the subject, why does the matrix class not have an xreplace method which applies xreplace to its elements, like it has for subs? -- 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 http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/da51f89a-b686-459d-a590-37049e42335d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
