> > Just if you are curious why it is an error at the moment. We can't have > it be filled in by python to be not in-place (`M = M @ P` meaning), but > copying over the result is a bit annoying and nobody was quite sure > about it, so it was delayed.
The problem with using out in-place is clear from trying `np.matmul(a, a, out=a)`: ``` In [487]: a array([[ 1. , 0. , 0. ], [ 0. , 0.8660254, 0.5 ], [ 0. , -0.5 , 0.8660254]]) In [488]: np.matmul(a, a) Out[488]: array([[ 1. , 0. , 0. ], [ 0. , 0.5 , 0.8660254], [ 0. , -0.8660254, 0.5 ]]) In [489]: np.matmul(a, a, out=a) Out[489]: array([[ 0., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.]]) ``` It would seem hard to avoid doing the copying (though obviously one should iterate over higher dimensiones, ie., temp.shape = M.shape[-2:]). Not dissimilar from cumsum etc which are also not true ufuncs (but where things can be made to work by ensuring operations are doing in the right order). -- Marten
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion