Python Forum
How to parallelize an 2D array?
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to parallelize an 2D array?
#3
(May-10-2017, 07:08 PM)Mekire Wrote: Why do you believe you need to parallelize this?

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])
>>>
Hi, thanks for your answer.

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.
Reply


Messages In This Thread
How to parallelize an 2D array? - by Felipe - May-10-2017, 07:03 PM
RE: How to parallelize an 2D array? - by Mekire - May-10-2017, 07:08 PM
RE: How to parallelize an 2D array? - by Felipe - May-10-2017, 07:18 PM
RE: How to parallelize an 2D array? - by nilamo - May-10-2017, 09:49 PM
RE: How to parallelize an 2D array? - by Felipe - May-10-2017, 10:15 PM
RE: How to parallelize an 2D array? - by nilamo - May-11-2017, 05:08 AM
RE: How to parallelize an 2D array? - by Felipe - May-11-2017, 01:44 PM
RE: How to parallelize an 2D array? - by nilamo - May-11-2017, 04:57 PM
RE: How to parallelize an 2D array? - by Felipe - May-13-2017, 05:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020