Matlab中的快速矩阵乘法 [英] fast matrix multiplication in Matlab

查看:165
本文介绍了Matlab中的快速矩阵乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在非常大的Matlab中进行矩阵/矢量乘法:"A"是一个655360 x 5实值矩阵,不一定稀疏,而"B"是655360 x 1实值向量.我的问题是如何计算:有效地计算B'* A.

I need to make a matrix/vector multiplication in Matlab of very large sizes: "A" is an 655360 by 5 real-valued matrix that are not necessarily sparse and "B" is a 655360 by 1 real-valued vector. My question is how to compute: B'*A efficiently.

我注意到,通过计算A'* B可以稍微改善时间,从而得到列向量.但这仍然很慢(我需要在程序中多次执行此操作).

I have notice a slight time improvement by computing A'*B instead, which gives a column vector. But still it is quite slow (I need to perform this operation several times in the program).

通过一点点搜索,我发现了一个有趣的Matlab工具箱 MTIMESX ,我希望它可以改善上述矩阵乘法性能.经过几次试验,与Matlab本机矩阵乘法相比,我只能获得很少的收益.

With a little bit search I found an interesting Matlab toolbox MTIMESX by James Tursa, which I hoped would improve the above matrix multiplication performance. After several trials, I can only have very marginal gains over the Matlab native matrix multiplication.

有关如何重写A'* B以便提高操作效率的任何建议?谢谢.

Any suggestions about how should I rewrite A'*B so that the operation is more efficient? Thanks.

推荐答案

Matlab的存在理由正在进行矩阵计算.如果您能以手工制作的工具大大胜过其内置矩阵乘法,我会感到非常惊讶.首先,您应该确保您的乘法实际上可以更快地执行.您可以通过使用Eigen在C ++中实现类似的乘法来实现此目的.

Matlab's raison d'etre is doing matrix computations. I would be fairly surprised if you could significantly outperform its built-in matrix multiplication with hand-crafted tools. First of all, you should make sure your multiplication can actually be performed significantly faster. You could do this by implementing a similar multiplication in C++ with Eigen.

这篇关于Matlab中的快速矩阵乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆