Thanks that works well
Execution time is down from ~3 seconds to 0.06 seconds
Eleanor
--
View this message in context:
http://old.nabble.com/Need-to-eliminate-a-nested-loop-tp31591457p31633558.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
___
Hi
The following code produces the desired result but has a slow triple loop
iterating over the matrix multiplication.
I'm sure it can be eliminated with a neat indexing trick but I can't figure
out how.
Any suggestions please?
-
import numpy
#define domain of functi
Hi
I'm trying to split an array into two pieces and have the two pieces in a
new dimension.
Here it is in code, because that's hard to explain in words.
>>>data.shape
(4, 50, 3)
>>>new_data = numpy.zeros((2, 4, 25, 3))
>>>new_data[0,...] = data[:,:25,:]
>>>new_data[1,...] = data[:,25:,:]
>>>ne
Hi
I want to apply a function (myfunc which takes and returns a scalar) to each
element in a multi-dimensioned array (data):
I can do this:
newdata = numpy.array([myfunc(d) for d in data.flat]).reshape(data.shape)
But I'm wondering if there's a faster more numpy way. I've looked at the
vectori
Is there a more concise way of assigning a variable to each column of an array?
This works
x,y,z = X[:,0],X[:,1],X[:,2]
but seems clumsy.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-dis