如何在 KDB 中堆叠矩阵?

发布于 2025-01-19 02:31:37 字数 201 浏览 1 评论 0原文

我正在尝试在矩阵开始时插入新的行,但是结果是插入我的行矢量旋转:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

晨光如昨 2025-01-26 02:31:37

(enlist b), a 给出您想要的结果。将 a 视为由嵌套列表组成是有帮助的,因此任何新行也应该采用这种形式。

(enlist b), a gives the result you want. It helps to think of a as being made from nested lists, hence any new rows should be of this form as well.

酸甜透明夹心 2025-01-26 02:31:37

或者,您可以使b矩阵。 join 在矩阵上按照您期望的方式工作。

q)(1 2#b),a
0.5 0.5
0.7 0.3
0.1 0.2

Or you can make b a matrix. Join on matrices works the way you expect.

q)(1 2#b),a
0.5 0.5
0.7 0.3
0.1 0.2
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文