Perl 中的矩阵乘法、3D 对象的易位
我想在 Perl 中将两个矩阵相乘。第一个 {n*4} 和第二个 {4*n}。我想从文本文件中获取值。我的一个文本文件看起来像
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
另一种如下所示
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
请帮助我。我的主要主题是将 3D x,y,x 坐标乘以某个值以将其转换到其他位置。提前致谢。
I want to multiply two matrices in Perl. 1st {n*4} with 2nd {4*n}. I want to fetch the values from a text file. my one text file looks like
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
and othe one is like the following
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
Please help me. My main motif is to multiply a 3D x,y,x coordinates with some value to translate it to other position. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用Math::Matrix。
Use Math::Matrix.
可以使用
PDL::Matrix
:PDL::Matrix
can be used:PDL 模块适合矩阵计算。
The PDL module is suited for matrix computations.
使用 PDL::Matrix 和
rcols
使用
rcols
读取以空格分隔的列的数据文件。例如,通过以下方式使用当前的 PDL-2.4.10 版本pdl2
shell 我们演示:注意:
$am
和$a
之间的唯一区别是PDL::Matrix
对象二维矩阵的维序约定与标准 PDL 约定相反。有关 PDL 所有内容的更多信息,请访问 PDL 网站,您可以在其中找到文档、邮件的链接列出档案,以及更多...Use PDL::Matrix and
rcols
Use
rcols
to read in data files of whitespace separated columns. For example, using the current PDL-2.4.10 release via thepdl2
shell we demonstrate:Note: the only difference between
$am
and$a
are that for thePDL::Matrix
objects the dimension order convention for the 2-D matrix is reversed from the standard PDL convention. For more information on all things PDL, please go to the PDL website where you'll find links to documentation, mailing list archives, and more...