2
我使用numpy来计算矩阵乘法。 如果我使用t = t * x,它工作得很好,但如果我使用t * = x,它不会。 我需要使用t = t * x吗?numpy * =不工作
import numpy as np
if __name__ == '__main__':
x = [
[0.9, 0.075, 0.025],
[0.15, 0.8, 0.05],
[0.25, 0.25, 0.5]
]
t = [1, 0, 0]
x = np.matrix(x)
t = np.matrix(t)
t = t * x # work , [[ 0.9 0.075 0.025]]
# t *= x # not work? always [[0 0 0]]
print t