【发布时间】:2021-12-30 10:13:34
【问题描述】:
我有两个数组:
dvec = np.repeat(0, k);dvec
mu = np.array([1,2,3,4,5])
Amat = np.stack((dvec, mu), axis=1);
还有一个矩阵
I = np.identity(k)
我想对它们进行列绑定以便拥有一个矩阵
Amat = np.stack((np.repeat(1,k), mu,I), axis=1);Amat
但是当我这样做时,python 会报告我
ValueError: all input arrays must have the same shape
我该如何解决这个错误?
【问题讨论】: