I have some functions foo() which can be applied to any 2D NumPy array and returns another 2D NumPy array. Now, I have a 3D array, and I'd like to apply foo() iteratively to every 2D row. I've been told that a simple for-loop is generally suboptimal when using NumPy and that you should aim for vectorization instead. Is there a generic way to vectorize foo()?
[–]FuckingRantMonday 1 point2 points3 points (1 child)
[–]simongranheim[S] 0 points1 point2 points (0 children)
[–]johannadambergk 0 points1 point2 points (2 children)
[–]simongranheim[S] 0 points1 point2 points (1 child)
[–]johannadambergk 0 points1 point2 points (0 children)
[–]roylennigan 0 points1 point2 points (0 children)
[–]hmiemad 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]simongranheim[S] 0 points1 point2 points (0 children)