Improving codegen(and related stuff)

99 views
Skip to first unread message

Arif Ahmed

unread,
Mar 20, 2017, 8:28:56 AM3/20/17
to sympy
Hi,
    I am writing a proposal for GSoC 2017 to improve the codegen module(https://github.com/sympy/sympy/wiki/GSoC-2017-Application-Arif-Ahmed:-Improve-Code-Generation-in-SymPy).

    Currently the proposal describes the workflow to implement a robust CSE algorithm. However, implementing it definitely would not take more than a month(maybe 5 weeks maximum).
     I was looking for issues related to codegen, ufuncify, lambdify, ccode, so that I can include a plan to fix those in my proposal as well.
    
     These are the implementations I would include :
         1. Make codegen work with matrices.(https://github.com/sympy/sympy/issues/11991)
         2. Improve the Python code printer. (https://github.com/sympy/sympy/issues/12213)
         3. Make ufuncify work with complex numbers. (https://github.com/sympy/sympy/issues/10522)

     If anyone would like to see any new implementation in SymPy's codegen then please do reply to this thread.

Regards --
Arif Ahmed

Jason Moore

unread,
Mar 25, 2017, 5:46:37 PM3/25/17
to sy...@googlegroups.com
Arif,

Search the open issues for a variety of keywords that you've listed above and check out the wiki for more codegen needs. There is plenty to do!

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@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/5f25542d-3505-49c1-9e7d-034ad54b4654%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arif Ahmed

unread,
Mar 29, 2017, 6:06:41 AM3/29/17
to sympy


On Sunday, March 26, 2017 at 3:16:37 AM UTC+5:30, Jason Moore wrote:
Arif,

Search the open issues for a variety of keywords that you've listed above and check out the wiki for more codegen needs. There is plenty to do!
On Mon, Mar 20, 2017 at 5:28 AM, Arif Ahmed <arif.ahmed...@gmail.com> wrote:
Hi,
    I am writing a proposal for GSoC 2017 to improve the codegen module(https://github.com/sympy/sympy/wiki/GSoC-2017-Application-Arif-Ahmed:-Improve-Code-Generation-in-SymPy).

    Currently the proposal describes the workflow to implement a robust CSE algorithm. However, implementing it definitely would not take more than a month(maybe 5 weeks maximum).
     I was looking for issues related to codegen, ufuncify, lambdify, ccode, so that I can include a plan to fix those in my proposal as well.
    
     These are the implementations I would include :
         1. Make codegen work with matrices.(https://github.com/sympy/sympy/issues/11991)
         2. Improve the Python code printer. (https://github.com/sympy/sympy/issues/12213)
         3. Make ufuncify work with complex numbers. (https://github.com/sympy/sympy/issues/10522)

     If anyone would like to see any new implementation in SymPy's codegen then please do reply to this thread.

Regards --
Arif Ahmed

--
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.

Aaron Meurer

unread,
Mar 29, 2017, 3:42:40 PM3/29/17
to sy...@googlegroups.com
Does the algorithm work for noncommutative products as well? I have a
pull request here that implements an ad hoc algorithm (it isn't from a
paper, it's just something I came up with)
https://github.com/sympy/sympy/pull/10271. I'd be interested to know
if this algorithm can supercede that.

I should point out that for your example, p = x - x**3 + x**5 - x**7,
cse(horner(p)) gives the same result as the paper. However,
multivariate horner is more complicated, so it could still be useful
(see https://github.com/sympy/sympy/pull/11586).

Note that Google has three evaluation periods starting this year
(previously it was two). However, your timeline does not necessarily
need to be split around those evaluation periods.

Aaron Meurer

On Wed, Mar 29, 2017 at 6:06 AM, Arif Ahmed
> https://groups.google.com/d/msgid/sympy/aa779c10-05c5-4372-a4c7-77cb66759cbd%40googlegroups.com.

Arif Ahmed

unread,
Mar 30, 2017, 3:24:46 AM3/30/17
to sympy
Thank you for reviewing !
My mid-terms get over tomorrow. I'll see how the algorithm can be modified to handle non-commutative variables.
As mentioned in the paper the Horner algorithm can yield the same results, but only for special cases. Horner does not give the most efficient result
for the other multivariate polynomial (the one mentioned in the beginning of the paper).
I will think over the timeline again. Interchanging Phase I and II might be better since I'll start addressing the mentioned codegen
issues from April 1st.

Arif Ahmed

unread,
Apr 1, 2017, 2:03:51 AM4/1/17
to sympy
Last night, I tried to find a workaround but was unable to do so. The problem lies in the CIM which does not account for non-commutativity.
I think a good starting point could be having two forms of the CIM : A commutative form and a non-commutative one.

For example,
If a, b are two non-commutative variables and a^2 * b + b * a^2 is the expression.

Normal form :

              a      b
a^2 * b    2      1
b * a^2    2      1

Non-commutative form :

              a      b    a
a^2 * b    2      1    0
b * a^2    0      1    2



On Thursday, March 30, 2017 at 1:12:40 AM UTC+5:30, Aaron Meurer wrote:
Reply all
Reply to author
Forward
0 new messages