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
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:,:]
new_data.shape
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
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