[Numpy-discussion] 3D array problem in Python

oc-spam66 oc-spam66@laposte....
Sun Dec 30 06:13:18 CST 2012


Hello,

> else:
>     val11[i][j], val22[i][j] = integrate.quad(lambda x: F1(x)*F2(x), 0, pi)

> But, this calculation takes so long time, let's say about 1 hour
> (theoretically)... Is there any better way to easily and fast calculate
> the process such as [ F( i ) for i in xlist ] or something like that
> rather than using for loop?

* What are F1() and F2()? Do they depend on anything else than 'x'? 
Maybe you meant Fi() and Fj(). In that case, can you benefit of a 
symmetry property?
* It's likely that all the computing time is in the "integrate" 
operation (check it with a profiler? %prun under ipython for example). 
In this situation, there's no improvement possible, apart from using a 
simpler function than integrate() that might be vectorized (this depends 
on the definition of Fi())


More information about the NumPy-Discussion mailing list