如何在朱莉娅产生对称矩阵?
诸如RAND(M,N)之类的功能会生成M行和N列的随机矩阵。朱莉娅(Julia)中是否有任何功能可以生成对称任意维度的矩阵?
Functions like rand(m,n) generate a random matrix of m rows and n columns. Is there any function in Julia that can generate a Symmetric matrix of arbitrary dimensions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像在
rand(M,N)
中创建一个对称矩阵,但是您将无法分配给非二角形元素,因为这可能会破坏其对称性。因此,您应该先创建常规矩阵,然后转换为对称。You can create a symmetric matrix as you do in
rand(m,n)
, but you will not be able to assign to non-diagonal elements as that might break its symmetry. So, you should create the general matrix first then convert to symmetric.