I think I understand what the purpose of the warning is, although I do not know enough about Numpy's internal functions to find out why the problem does not occur.
, , , ( ). Numpy , .
() - += 2d-:
def matrix_iadd(lhs, rhs):
for i in range(lhs.shape[0]):
for j in range(lhs.shape[1]):
lhs[i,j] += rhs[i,j]
return lhs
, , rhs - , lhs (, ). :
>>> a = np.arange(9)
>>> a.shape=(3,3)
>>> a
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
>>> a.T
array([[0, 3, 6],
[1, 4, 7],
[2, 5, 8]])
>>> matrix_iadd(a, a.T)
array([[ 0, 4, 8],
[ 7, 8, 12],
[14, 19, 16]])
, , , , . lhs[0,1] ( rhs[0,1] 3 1), rhs[1,0] . , lhs[1,0] , rhs[1,0] .
, , , , numpy . , Numpy, , , , Numpy. . , , , .