May-10-2017, 07:18 PM
(May-10-2017, 07:08 PM)Mekire Wrote: Why do you believe you need to parallelize this?Hi, thanks for your answer.
You seem to be using numpy incorrectly/badly so you should probably address that first.
>>> import numpy as np >>> a = np.array([[1,2,3],[4,5,6],[7,8,9]]) >>> a array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> np.sum(a) # total sum of array 45 >>> np.sum(a, 0) # sums of each column array([12, 15, 18]) >>> np.sum(a, 1) # sums of each row array([ 6, 15, 24]) >>>
Let me try to be more clear. The code that I wrote above, its only a simple example to try to learn how to parallelize a situation using an 2D array. The real code that I want to parallelize is much more complex, involving minimization algorithms and another stuffs. But I can't do it, if first don't learn how to do it in a simple example, like the one that I posted in this thread.