如何在numpy中制作矩阵向量
我想在numpy中创建一个相同矩阵的向量(作为数组)。假设矩阵是:
w = np.array([[1,2],
[3,4],
[5,6]])
那么,如何在每个位置中使用矩阵创建一个固定长度的向量?
那就是:vector [0] = ... = vector [n] = w
I would like to create a vector of the same matrix in numpy (so as an array). Let's say the matrix is:
w = np.array([[1,2],
[3,4],
[5,6]])
Then, how can I create a vector of a fixed length with the matrix w
in every position?
That is: vector[0] = ... = vector[n] = w
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定要确切的预期输出,要创建一个额外的维度,您可以使用
numpy.tile
:nb。
vector
实际上不是(1D)向量,而是3D数组输出:
Not sure of the exact expected output, to to create an additional dimension you could use
numpy.tile
:NB.
vector
is not really a (1D) vector it is a 3D arrayoutput: