On Thu, 14 Apr 2022 at 03:13, Oscar René Garzón Castro <oscar.gar...@ciencias.unam.mx> wrote: > > I mean the points in the Linear algebra subsection of Idea Prompts > (https://github.com/sympy/sympy/wiki/GSoC-Ideas#idea-prompts). I am > interested in some of this points but I'm not sure how many of them are > expected for a 350 hours project.
The notes there are very much out of date. There is plenty of work to be done along the "specialised data types" idea. That has already been started as the DomainMatrix class which is now used internally by the Matrix class. Most of the operations for Matrix don't make use of the more efficient DomainMatrix methods though. Here's a simple example: In [5]: M = randMatrix(10) # 10x10 matrix In [6]: %time ok = M.inv() CPU times: user 76 ms, sys: 0 ns, total: 76 ms Wall time: 77.8 ms In [7]: %time ok = M._rep.to_field().inv() CPU times: user 0 ns, sys: 0 ns, total: 0 ns Wall time: 2.46 ms The difference is starker if you increase the size of the matrix e.g. for 20x20 it's 30ms vs basically forever. For a matrix of only integers like this the DomainMatrix method is much faster and should always be used. Currently the Matrix class still uses its much slower inv method though. What needs to be done: 1. Make Matrix use more efficient DomainMatrix methods. 2. Add/complete/optimise DomainMatrix methods for important algorithms (inv, rref, charpoly etc). 3. Explore and benchmark when different operations are better done with some particular domain and consider alternative algorithms e.g. when is it better to use an explicit inverse formula or row reduction. 4. Add helpers to efficiently convert to different domains and to decide which domain should be used. 5. Make better use of block decompositions of matrices (i.e. connected_components). There's plenty to do there but you need to look at the code yourself and try examples to understand what that is. The fastest library I know of for these operations is flint which should be made usable as an optional dependency through the python_flint bindings. In [1]: M = randMatrix(100) In [2]: import flint In [3]: fM = flint.fmpz_mat([[int(Mij) for Mij in Mi] for Mi in M.tolist()]) In [4]: %time ok = fM.inv() CPU times: user 428 ms, sys: 8 ms, total: 436 ms Wall time: 433 ms In [5]: %time ok = M._rep.to_field().inv() CPU times: user 6.97 s, sys: 4 ms, total: 6.98 s Wall time: 6.98 s You can see there that in this example flint is about 15x faster than DomainMatrix. That's basically the difference between Python and C when working with unbounded integers. -- Oscar > El miércoles, 13 de abril de 2022 a las 15:23:55 UTC-5, brombo escribió: >> >> If you are interested in linear algebra you might find the following book >> and link interesting - >> >> https://smile.amazon.com/Linear-Geometric-Algebra-Alan-Macdonald/dp/1453854932/ref=sr_1_1?crid=386O85ZQLUMEZ&keywords=alan+macdonald+linear+algebra&qid=1649881349&sprefix=alan+mac+donald+linear+algebra%2Caps%2C35&sr=8-1 >> >> and >> >> https://galgebra.readthedocs.io/en/latest/ >> >> On 4/12/22 8:43 PM, Oscar René Garzón Castro wrote: >> >> Hi all, >> >> My name is Oscar Garzon. I have been programming in Python for two years, >> school projects and also personal projects. I amm a 3rd-year undergraduate >> student, studying mathematics at University of Mexico (UNAM). I've taken two >> courses in Linear algebra. I've used SymPy to solve equations systems. >> >> I am interested in implementing Linear algebra and looking for a 350 hours >> project. For a project of this length, my proposal should include all the >> subtasks in Linear algebra or only in a number of them? >> >> Kind Regards, >> Oscar Garzon >> >> -- >> >> 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+un...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/2faf8c4e-f887-47ca-92a3-7d443ddad936n%40googlegroups.com. > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/5a62fe76-a526-43d8-bac1-cef6cd98835cn%40googlegroups.com. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxQ4OngA0d1rNxag-fZyZHOQN7SNGRtupqA5A5a%3DJW%2BDNg%40mail.gmail.com.