如何在 KDB 中堆叠矩阵?
我正在尝试在矩阵开始时插入新的行,但是结果是插入我的行矢量旋转:
a: (.7 .3; .1 .2)
b: (.5 .5)
b, a
0.5
0.5
0.7 0.3
0.1 0.2
预期结果:
0.5 0.5
0.7 0.3
0.1 0.2
我在做什么错?
I'm trying to insert a new row at the beginning of a matrix, but the result is inserting my row vector rotated:
a: (.7 .3; .1 .2)
b: (.5 .5)
b, a
0.5
0.5
0.7 0.3
0.1 0.2
Intended result:
0.5 0.5
0.7 0.3
0.1 0.2
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(enlist b), a
给出您想要的结果。将a
视为由嵌套列表组成是有帮助的,因此任何新行也应该采用这种形式。(enlist b), a
gives the result you want. It helps to think ofa
as being made from nested lists, hence any new rows should be of this form as well.或者,您可以使
b
矩阵。 join 在矩阵上按照您期望的方式工作。Or you can make
b
a matrix. Join on matrices works the way you expect.