# [SciPy-User] Parallelizing a for loop

Charles R Harris charlesr.harris@gmail....
Thu Dec 24 14:10:45 CST 2009

```On Thu, Dec 24, 2009 at 10:02 AM, Scott Askey <scotta_2002@yahoo.com> wrote:

> Also, where might I find guidance for how to get rid of for loops/
>
>
>
>
> ----- Original Message ----
> To: scipy-user@scipy.org
> Sent: Thu, December 24, 2009 9:50:13 AM
> Subject: Re: Parallelizing a for loop
>
> Anne:
>
> A pointer to the tools in numpy to apply array operation to my function
> would be appreciated.
> I found found the scipy.vectorize but it did not seem applicable to my 42
> input
>
> As best I could tell I seemed that the time required to calculate two
> elements (2 x dof in residual 500 times) was the same as calculating  1 x
> dof residual 1000 times in a for loop.
>
> Chuck:
>
> It is a time marching structural dynamics 1-d beam problem.  The 100 or so
> parameters are the initial conditions, geometric and material properties.
>  The 42 dof are the configuration of the  element at the end of the time
> step.  Given the array of (42 * elements) initial conditions the residuals
> for each element may be independently calculated.
>
> Currently I calculate the 42*elements residual by running  "for i in
> range(element)" and getting  42 residuals in each iteration.
>
> My element residual function is at most at worst cubic polynomials.
> The element wise residual and fprime functions are lambdafiedsympy
> functions.
>
>
The reason I asked is that there are a couple of finite element packages
available for python. Two of them are SfePy <http://sfepy.org/> and
FiPy<http://www.ctcms.nist.gov/fipy/>.
I don't know if either is directly applicable to your problem. As to fsolve,
are you directly computing the Jacobian or do you let the routine compute it
numerically?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091224/f80a9601/attachment.html
```