On Thu, 14 Mar 2019 at 21:19, Aaron Meurer <asmeu...@gmail.com> wrote: > > I agree. The biggest challenge with symbolic matrices is expression > blow up. In some cases it is unavoidable, for instance, symbolic > eigenvalues/eigenvectors use the symbolic solutions to polynomials, > which are complicated in the general case for n > 2. > > One thing I meant by "overhead" is that if the type of a matrix's > entries is known to all be rational numbers, for instance, we can > operate directly on those numbers, ideally using fast number types > like gmpy.mpq. If they are all rational functions, we can use > polynomial algorithms that operate on rational functions. These always > keep rational functions in canonical form, and the zero equivalence > testing becomes literally "expr == 0" (no simplification required). > These can be more efficient than general symbolic manipulation. > > This is how the polys module is structured. See > https://docs.sympy.org/latest/modules/polys/internals.html. It would > be nice to have a similar structure in the matrices, where a matrix > can have a ground domain (or type) associated with its underlying > data.
There is an example of this here: https://github.com/sympy/sympy/issues/16823 The matrix is all numbers of the form q1+I*q2 for rational q1 and q2 and the expressions blow up leading to terrible asymptotic performance. It could probably be made a lot faster with judicious use of expand but actually having a fast only complex number matrix routine would speed that up massively. -- Oscar -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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/CAHVvXxSTPcKsQY4E%2BS046LyDMhKYvKgFF97xVqT_oSmWY7F1zA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.