Reputation: 3048
I have the following code:
l = -r_dot_k - sq_rt + 2*sq_rt*(npl.norm(r_rel,axis=1)<np.abs(self._radius))
l.reshape(N,1)
intercept_pt = ray_direction*l + ray_point
#r_dot_k: (25L,)
#sq_rt: (25L,)
#r_rel: (25L,3L)
#l: (25L,) #after first line
#ray_direction: (25L,3L)
#ray_point: (25L,3L)
There is an error for the third line saying that 'operands could not be broadcast together with shapes (25,3) (25,)'. Since the shape of l is not correct, I add the second line to try to change the shape of l from (25L,) to (25L,1L), but it doesn't work. The shape of l before and after the second line is still (25L,). Why? How should I reshape l so that the third line can run?
Upvotes: 0
Views: 78
Reputation: 25813
array.reshape
doesn't modify array
it returns a new array with the new shape. I think you want:
l = l.reashape(N, 1)
Upvotes: 2