如何在朱莉娅中生成任意等级的随机矩阵?

发布于 2025-02-10 20:36:39 字数 60 浏览 3 评论 0原文

朱莉娅有什么办法可以生成具有任意/指定等级的随机矩阵?例如,是否有任何功能可以生成等级2的随机3x3矩阵?

Is there any way in Julia to generate a random matrix that has some arbitrary/specified rank? For example, is there any function that would allow generating a random 3x3 matrix of rank 2?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

忘年祭陌 2025-02-17 20:36:39

这取决于您所说的“随机矩阵”(即什么分布?),但是rand(3,2)*rand(2,3)将产生一个随机矩阵3x3等级的矩阵2分布。

This depends a little on what you mean by "random matrix" (i.e. what distribution?), but rand(3,2)*rand(2,3) will produce a random matrix 3x3 matrix of rank 2 with some distribution.

紫南 2025-02-17 20:36:39

一种选择是生成R随机向量(独立的概率1),并用后者的随机(或预定义)线性组合填充其余的矩阵。

极简主义的解决方案是复制一些初始向量。

An option is to generate r random vectors (probability 1 of being independent) and fill the rest of the matrix with random (or predefined) linear combinations of the latter.

A minimalist solution is to just replicate some of the initial vectors.

明天过后 2025-02-17 20:36:39

生成所需格式的随机矩阵,计算其SVD,根据等级将较低的单数值设置为零,重建等级降低的矩阵。

与随机矩阵的乘法产生的相比,这应该给出不同的“随机”,更高的成本。

Generate a random matrix of the desired format, compute its SVD, set the lower singular values to zero according to the rank, reconstruct the rank-reduced matrix.

This should give a different kind of "random", at higher cost, than the one resulting from the multiplication of random matrices.

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