You should take a look at the work that was done by Björn Dahlgren in 2017. Here is the report https://github.com/sympy/sympy/wiki/GSoC-2017-Report-Björn-Dahlgren:-Improved-code-generation-facilities. I think it would be great to continue that work to have better support for matrices. Note that the his project mostly focused on sympy.codegen, which, so far, is somewhat separate from the codegen stuff in sympy.utilities. We eventually would like to merge them, but it would be better to prefer improvements to sympy.codegen, the newer module.
Having better matrix support would be awesome. I worked on a project a couple of years ago that needed to use the NumPy/Python codegen on matrices, and had to extend the printers manually (see https://github.com/ergs/transmutagen/blob/master/transmutagen/codegen.py). It would be great if that sort of thing were built in to the NumPy printer, as well as all the other code printers (at least for languages with good matrix support). As for documentation, there is https://docs.sympy.org/latest/modules/codegen.html, which tries to go over the different "layers" of code generation in SymPy. There is also a talk I gave at SciPy (https://www.youtube.com/watch?v=nmI-cDAUjdE) (my talk is somewhat high level; chances are if you already know what code generation is you won't get much from it), as well as a tutorial that we gave https://www.sympy.org/scipy-2017-codegen-tutorial/ (this was during Björn's project, so most of the work he did is not included there because it wasn't merged yet). Aaron Meurer On Thu, Mar 21, 2019 at 6:44 PM Ankit Pandey <arpandeyt...@gmail.com> wrote: > > Hi everyone, > > I am a third year student at Grinnell College in Grinnell, Iowa, and I'd like > to > work on expanding Sympy's code generation capabilities. More specifically, I'd > like to improve how Sympy generates code for handling matrices. > > Øyvind Jensen worked on expanding codegen's ability to handle expressions > involving IndexedBases and Matrix in the summer of 2010, so C and Fortran > expressions are able to loop over the arguments of an input array. However, > these languages have libraries that allow abstracting matrix operations in > addition to optimizing them (the ideas page suggests LAPACK, and Øyvind Jensen > also added support for Python's very own Theano, but this seems very rough). > > Since each target language has its own method of handling matricies, right now > my idea is to extend codegen and its AST and implement the relevant matrix > operations for each language (which seems easier for some more than others, > since e.g. octave already implements many of the operations Sympy represents). > My question is, how viable is this as a project for a summer? Also, I've > submitted some small pull requests (https://github.com/sympy/sympy/pull/16369 > and https://github.com/sympy/sympy/pull/16331) to help me familiarize myself > with codegen. Are there any other issues/documentation I should look into? > > > Thanks! > > -- > 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/f34dff96-3a77-498b-acad-98ec77c09029%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/CAKgW%3D6L6v32ruYRFFtP54SW68xh-YtycH0XmP7Xb%2B_rDdyPU2A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.