On a semi-related note I think it'd be awesome if SymPy created a Theano code generator. Our two projects are related and I think that there is something to be gained by cooperation. We optimize and simplify expressions in semi-orthogonal ways.
On Fri, Jul 6, 2012 at 10:45 AM, Matthew Rocklin <mrock...@gmail.com> wrote: > It would be nice if SymPy could do this. I'm unfortunately not very > familiar with the code generation module. If it's not possible now then we > should make an issue for it. > > Alternatively you could take a look at the theano > project<http://deeplearning.net/software/theano/>. > They optimize and generate code for symbolic expressions. They're tightly > integrated with NumPy as well. They tend to specialize more in array > expressions but I'm sure that what you're proposing in your example is > possible. They are pretty responsive on their e-mail list > groups.google.com/group/theano-users > > -Matt > > On Fri, Jul 6, 2012 at 10:22 AM, Gustavo <gustavo.goret...@gmail.com>wrote: > >> Is it possible to accomplish this using an out parameter? This would >> still be useful to me. >> >> >> On Monday, January 23, 2012 2:20:50 PM UTC-5, Gustavo wrote: >>> >>> Right now it returns a <float>. I'd like an NumPy array, so maybe I >>> can create the NumPy array with the correct size and row/column >>> ordering and pass it as an "out parameter" to the code generator. >>> >>> On Jan 23, 12:57 pm, Aaron Meurer <asmeu...@gmail.com> wrote: >>> > But what kind of object would you expect to be used for the Matrox? >>> > >>> > Aaron Meurer >>> > >>> > On Jan 22, 2012, at 11:50 PM, Gustavo <gustavo.goret...@gmail.com> >>> wrote: >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > > Sorry for the vagueness. This is what I'd like: >>> > >>> > > import sympy >>> > > from sympy.utilities.autowrap import autowrap >>> > >>> > > x = sympy.symbol.symbols('x') >>> > > m = sympy.Matrix([x,sympy.cos(x)]) >>> > > f = autowrap(m) >>> > >>> > > CodeGenError: Fortran only supports a single or no return value. >>> > >>> > > It's possible to autowrap each element of "m" separately, but then I >>> > > might miss out on some optimization opportunities, like common >>> > > subexpression elimination. >>> > >>> > > On Jan 21, 7:51 pm, Matthew <mrock...@gmail.com> wrote: >>> > >> Hi Gustavo, >>> > >>> > >> Can you say more about what you want? I don't understand. It might >>> be >>> > >> helpful to give an example of what you want to work. >>> > >>> > >> -Matt >>> > >>> > >> On Jan 21, 2:07 am, Gustavo <gustavo.goret...@gmail.com> wrote: >>> > >>> > >>> How can I autowrap a matrix expression without making an >>> autofunction >>> > >>> from each of the elements >>> > >>> > > -- >>> > > You received this message because you are subscribed to the Google >>> Groups "sympy" group. >>> > > To post to this group, send email to sympy@googlegroups.com. >>> > > To unsubscribe from this group, send email to sympy+unsubscribe@** >>> googlegroups.com <sympy%2bunsubscr...@googlegroups.com>. >>> > > For more options, visit this group athttp://groups.google.com/** >>> group/sympy?hl=en <http://groups.google.com/group/sympy?hl=en>. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/sympy/-/mCUBg_bgcjgJ. >> >> To post to this group, send email to sympy@googlegroups.com. >> To unsubscribe from this group, send email to >> sympy+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/sympy?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.