-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
The module Matrices in SymPy doesn't support type mpq from gmpy2. #16883
Comments
Matrix elements are converted to SymPy types by default. There is a variant class |
@jksuom Thank you very much. I'll try to do it. |
@jksuom |
@adukova >>> A.nullspace()
[]
>>> A.rank()
2 And I think Mathematica gives the same answer. |
Can you describe the problems you meet? |
I have matrices of sizes about 50 x 50. The entries are rational numbers with long numerators and denominators (about 50 digits and more). I need ranks for a finite sequence from such matrices (about 50 terms). Maple solves this problem in reasonable time (from 1 sec to 1 hour). The analogous routine in SymPy for some example can not solve the problem in five hours. I think the problem is that the module Matrices can not work with the library gmpy2. Moreover if entries were complex numbers the function rank in SymPy returned a wrong result. But this problem is solved now (see issue #16823). |
Thank you all. It seems in the case of real matrices the problem is solved:
|
I have found the behavior that the matrix gets gradually filled with SymPy number types in each step of computation. So the booster may not last long. |
That should not happen. The existing variant matrix subclasses ( |
Matrix codebase currently makes use of the hardcoded constants S.Zero and S.One. That is inconvenient when a non-Basic data type is used to speed up computation (cf. #16883). This PR replaces these constants with class attributes zero and one that can be modified by subclassing.
Dear jksuom, Unfortunately, I know you only as jksuom in the forum GitHub . Thank you very much for your advice to my daughter Adukova Nataliya (GitHub issue # 16883). Can I thank you in my article for Journal of Symbolic Computation? Best wishes, V. Adukov |
Yes, of course, you can do that.
My name is Kalevi Suominen. |
@jksuom |
Example
It does not allow to work with long arithmetic in linear algebra.
The text was updated successfully, but these errors were encountered: