[sympy] Re: Speeding up expression evaluations

2010-03-03 Thread wflynny
On Mar 3, 2:28 pm, Ondrej Certik wrote: > Hi Bill! > > On Wed, Mar 3, 2010 at 11:24 AM, wflynny wrote: > > Hi! > > > I have a huge sympy expression and in our current implementation, I > > numerically evaluate the expression hundreds to thousands of times > > using .subs, lambda functions, list

[sympy] Re: Speeding up expression evaluations

2010-03-04 Thread Vinzent Steinberg
On Mar 3, 8:24 pm, wflynny wrote: > Hi! > > I have a huge sympy expression and in our current implementation, I > numerically evaluate the expression hundreds to thousands of times > using .subs, lambda functions, list comprehension, etc. As you can > imagine, this is very slow. > > I am looking a

[sympy] Re: Speeding up expression evaluations

2010-03-09 Thread wflynny
Sorry for the absence - I was travelling for the past few days. As for lambdify, the problem is this: we have a list of parameters, such as x,y,z, a list of symbolic eigenvalues that are functions of x,y,z and a large expression that is a function of x,y,z and the eigenvalues. The current evaluati

Re: [sympy] Re: Speeding up expression evaluations

2010-03-04 Thread Rohit Garg
Hi, > We tried lambdify but there a few problems. Many of the for loops we > were using were of the form > for i in I: >   numerically evaluate X >   Y = f(X) >   for a in A: >      EXPR.subs(a,Y) >   ... First, a few clarifications. 1) I am not 100% with sympy internals, but AFAICS a is a sympy

Re: [sympy] Re: Speeding up expression evaluations

2010-03-04 Thread Rohit Garg
On Thu, Mar 4, 2010 at 11:50 PM, Rohit Garg wrote: > First, a few clarifications. > > 1) I am not 100% with sympy internals, but AFAICS a is a sympy > expression. And sympy only allows single line expressions. By that I > mean, expressions involving only the 4 arithmetic operators, > mathematical

Re: [sympy] Re: Speeding up expression evaluations

2010-03-04 Thread Ondrej Certik
On Thu, Mar 4, 2010 at 10:20 AM, Rohit Garg wrote: > Hi, > >> We tried lambdify but there a few problems. Many of the for loops we >> were using were of the form >> for i in I: >>   numerically evaluate X >>   Y = f(X) >>   for a in A: >>      EXPR.subs(a,Y) >>   ... > > First, a few clarification

Re: [sympy] Re: Speeding up expression evaluations

2010-03-04 Thread Rohit Garg
> Thanks Rohit for the help. I need to understand the problem better. In > my experience, the best way is to use lambdify with numpy, then create > a numpy array of values and pass it to it --- this then uses numpy to > evaluate for lots of values at once and it is *very* efficient. This is anoth

Re: [sympy] Re: Speeding up expression evaluations

2010-03-05 Thread william ratcliff
We actually have another use case--currently, we are running the code for "small" datasets of around 600 data points. However, we will need to be able to scale to datasets of 600,000 data points. We are currently trying to get this to run on a cluster--for this approach, numpy is good. However,

Re: [sympy] Re: Speeding up expression evaluations

2010-03-05 Thread Rohit Garg
I am a bit puzzled at this. You are suggesting that CUDA is a good fit for your application, provided you can get the C code for that function. That would mean that your computations can be written in a very data parallel friendly manner. Then why is lambdify() not suitable for you? for i in I:

Re: [sympy] Re: Speeding up expression evaluations

2010-03-05 Thread Ondrej Certik
On Fri, Mar 5, 2010 at 8:47 AM, Rohit Garg wrote: > I am a bit puzzled at this. You are suggesting that CUDA is a good fit > for your application, provided you can get the C code for that > function. > > That would mean that your computations can be written in a very data > parallel friendly manne