写了一个模块文件hellohello.py
import numpy as np
def xgate(qinput):
xmat = np.matrix([[0, 1],
[1, 0]])
return np.matmul(xgate,qinput)
在Jupyter Notebook上
import numpy as np
state1 = np.array([0.2,0.8])
state1 = state1[:,None]
import hellohello
hellohello.xgate(state1)
报错
你是想做矩阵相乘?
return np.matmul(xgate,qinput)
中的 xgate 应改成 xmat 吧?输出